Skip to content

Conversation

@JelleZijlstra
Copy link
Member

Didn't merge the stubs because all functions have additional parameters since 3.2,
so there would be no shared code between 2 and 3.

Didn't merge the stubs because all functions have additional parameters since 3.2,
so there would be no shared code between 2 and 3.
@ambv
Copy link
Contributor

ambv commented Mar 18, 2017

Good call!

@ambv ambv merged commit efdf2f1 into python:master Mar 18, 2017
if sys.version_info < (3, 5):
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: _Path = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ...) -> None: ...
else:
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: _Path = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ..., workers: int = ...) -> None: ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://docs.python.org/3/library/compileall.html, ddir is Optional.

def compile_dir(dir: _Path, maxlevels: int = ..., ddir: _Path = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ...) -> None: ...
else:
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: _Path = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ..., workers: int = ...) -> None: ...
def compile_file(fullname: _Path, ddir: _Path = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ...) -> None: ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, ddir is optional (probably everywhere in this module).

_Path = Union[str, bytes]

# fx can be any object with a 'search' method; once we have Protocols we can change the type
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: _Path = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ...) -> None: ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like ddir should be Optional.

@JelleZijlstra
Copy link
Member Author

Opening a new PR to address Jukka's comments.

hswong3i pushed a commit to alvistack/python-typeshed that referenced this pull request May 25, 2025
…ersion (python#1024)

As pointed out in python#1023, there is no risk of incompatibility, since the
requires-python field will prevent installation on older Python versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants