[issue38691] importlib: PYTHONCASEOK should be ignored when using python3 -E

2020-02-18 Thread Kyle Stanley


Kyle Stanley  added the comment:

>From what I can tell, the regression seems like it could be fixed by adding 
>"@unittest.skipIf(sys.flags.ignore_environment)" to the following tests in 
>python/cpython/Lib/test/test_importlib/source/test_case_sensitivity.py that 
>modify "PYTHONCASEOK":

CaseSensitivityTest.test_sensitive
CaseSensitivityTest.test_insensitive

Those tests seem ultimately pointless if environmental variables are being 
ignored (-E or -I), so I think in this case it's a misleading test failure, no?

--
nosy: +aeros

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39672] SIGSEGV crash on shutdown with shelve & c pickle

2020-02-18 Thread zd nex


zd nex  added the comment:

So I was trying to figure out what is crash it self and it looks to me that it 
is related to import. Do you know how I can properly debug this crash?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39686] add dump_json to ast module

2020-02-18 Thread Richard K


Change by Richard K :


--
keywords: +patch
pull_requests: +17938
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18558

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39686] add dump_json to ast module

2020-02-18 Thread Richard K


New submission from Richard K :

Currently within the ast module, `dump` generates a string representation of 
the AST for example,

>>> ast.dump(node)
'Module(body=[], type_ignores=[])'


The proposed enhancement would provide a complementary function, `dump_json` as 
in a json representation of the ast. 
This would be useful for those who would like to benefit from the utilities of 
the json module for formatting, pretty-printing, and the like.  
It would also be useful for those who want to serialize the AST or export it in 
a form that can be consumed in an other programming language.
A simplified example, 


>>> import ast
>>> node = ast.parse('')
>>> ast.dump_json(node)
{'Module': {'body': [], 'type_ignores': []}}


A simplified example of using `ast.dump_json` with the json module,

>>> import json
>>> json.dumps(ast.dump_json(node))
'{"Module": {"body": [], "type_ignores": []}}'

--
components: Library (Lib)
messages: 362256
nosy: sparverius
priority: normal
severity: normal
status: open
title: add dump_json to ast module
type: enhancement
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39685] Python 3.8 regression Socket operation on non-socket

2020-02-18 Thread Brian May


New submission from Brian May :

After upgrading to Python 3.8, users of sshuttle report seeing this error:

Traceback (most recent call last):
  File "", line 1, in 
  File "assembler.py", line 38, in 
  File "sshuttle.server", line 298, in main
  File "/usr/lib/python3.8/socket.py", line 544, in fromfd
return socket(family, type, proto, nfd)
  File "/usr/lib/python3.8/socket.py", line 231, in __init__
_socket.socket.__init__(self, family, type, proto, fileno)
OSError: [Errno 88] Socket operation on non-socket

https://github.com/sshuttle/sshuttle/issues/381

The cause of the error is this line: 
https://github.com/sshuttle/sshuttle/blob/6ad4473c87511bcafaec3d8d0c69dfcb166b48ed/sshuttle/server.py#L297
 which does:

socket.fromfd(sys.stdin.fileno(), socket.AF_INET, socket.SOCK_STREAM)
socket.fromfd(sys.stdout.fileno(), socket.AF_INET, socket.SOCK_STREAM)

Where sys.stdin and sys.stdout are stdin/stdout provided by the ssh server when 
it ran our remote ssh process.

I believe this change in behavior is as a result of a fix for the following 
bug: https://bugs.python.org/issue35415

I am wondering if this is a bug in Python for causing such a regression, or a 
bug in sshuttle. Possibly sshuttle is using socket.fromfd in a way that was 
never intended?

Would appreciate an authoritative answer on this.

Thanks

--
components: IO
messages: 362255
nosy: brian
priority: normal
severity: normal
status: open
title: Python 3.8 regression Socket operation on non-socket
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39139] Reference to depricated collections.abc class in collections is unnecessary and confusing

2020-02-18 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

The removal in 3.9 was reverted and postponed to 3.10 in issue39674.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39679] functools: singledispatchmethod doesn't work with classmethod

2020-02-18 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I guess the method checks for annotation on cls [0] which will be 
classmethod/staticmethod object in the report and won't have annotations. The 
annotations should be looked up in the function the classmethod/staticmethod 
decorator wraps around as in cls.__func__ . Something like below so that the 
right annotations are picked up. In addition to this the registry should store 
the type annotation as key to cls or cls.__func__ depending on normal method or 
classmethod/staticmethod.

diff --git Lib/functools.py Lib/functools.py
index 050bec8605..a66711208d 100644
--- Lib/functools.py
+++ Lib/functools.py
@@ -1073,24 +1073,33 @@ def singledispatch(func):
 if func is None:
 if isinstance(cls, type):
 return lambda f: register(cls, f)
-ann = getattr(cls, '__annotations__', {})
+if isinstance(cls, (classmethod, staticmethod)):
+ann = getattr(cls.__func__, '__annotations__', {})
+func = cls.__func__
+else:
+ann = getattr(cls, '__annotations__', {})
+func = cls

[0] 
https://github.com/python/cpython/blob/ab6423fe2de0ed5f8a0dc86a9c7070229326b0f0/Lib/functools.py#L1076

--
nosy: +levkivskyi, ncoghlan, xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39572] [typing] TypedDict's 'total' argument is undocumented

2020-02-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

Separately, would you also be interested in writing docs for the `__total__` 
class attribute of TypedDict subclasses (3.8 and 3.9) and for the 
`__required_keys__` and `__total_keys__` attributes (only in 3.9)? (Sorry, 
there's no document you can crib these from. :-)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39572] [typing] TypedDict's 'total' argument is undocumented

2020-02-18 Thread miss-islington

miss-islington  added the comment:


New changeset 44c690112d96a81fe02433de7900a4f8f9457012 by Miss Islington (bot) 
in branch '3.8':
bpo-39572: Document ’total’ flag of TypedDict (GH-18554)
https://github.com/python/cpython/commit/44c690112d96a81fe02433de7900a4f8f9457012


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39684] PyUnicode_IsIdentifier has two if/thens that can be combined

2020-02-18 Thread Andy Lester


Change by Andy Lester :


--
keywords: +patch
pull_requests: +17937
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18557

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39684] PyUnicode_IsIdentifier has two if/thens that can be combined

2020-02-18 Thread Andy Lester


New submission from Andy Lester :

These two code if/thens can be combined

if (ready) {
kind = PyUnicode_KIND(self);
data = PyUnicode_DATA(self);
}
else {
wstr = _PyUnicode_WSTR(self);
}

Py_UCS4 ch;
if (ready) {
ch = PyUnicode_READ(kind, data, 0);
}
else {
ch = wstr[0];
}

--
components: Interpreter Core
messages: 362250
nosy: petdance
priority: normal
severity: normal
status: open
title: PyUnicode_IsIdentifier has two if/thens that can be combined

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17050] argparse.REMAINDER doesn't work as first argument

2020-02-18 Thread hai shi


hai shi  added the comment:

> Okay. Would it be all right if I submit a fix to get it working at least in 
> the subparser case?

Hi, dHannasch. According raymond and paul's opinion, you could try to create a 
PR to update argparse's doc.

--
nosy: +shihai1991

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39572] [typing] TypedDict's 'total' argument is undocumented

2020-02-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17936
pull_request: https://github.com/python/cpython/pull/18556

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38860] GenericPyCData_new does not invoke new or init

2020-02-18 Thread Kyle Stanley


Kyle Stanley  added the comment:

Justin Capella wrote:
> Is there a better forum for discussion about design/behavior, maybe the more 
> generic issue of GenericPyCData_new using tp_alloc instead of tp_new

Rebecca Morgan wrote:
> I would still be interested in this, with some clarity on the 
> testing/expected behavior.

I'm not personally active on the capi-sig mailing list, but it seems like it 
would be a suitable location for discussing the behavior of GenericPyCData_new. 
If you don't receive a response in capi-sig, you could also try python-dev to 
bring some attention to the issue since most of the core developers actively 
check there.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39572] [typing] TypedDict's 'total' argument is undocumented

2020-02-18 Thread Guido van Rossum

Guido van Rossum  added the comment:


New changeset ab6423fe2de0ed5f8a0dc86a9c7070229326b0f0 by ananthan-123 in 
branch 'master':
bpo-39572: Document ’total’ flag of TypedDict (GH-18554)
https://github.com/python/cpython/commit/ab6423fe2de0ed5f8a0dc86a9c7070229326b0f0


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39679] functools: singledispatchmethod doesn't work with classmethod

2020-02-18 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +lukasz.langa

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39682] pathlib.Path objects can be used as context managers

2020-02-18 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +brett.cannon, pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39670] 2to3 fix_apply tries to fix user-defined apply function calls

2020-02-18 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

The fixers are supposed to be executed on Python 2 files where apply was a 
builtin and was shadowed. So from the context of the fixer it tries to make the 
modification and it cannot distinguish that it's a builtin or user-defined 
call. In Python 3 the apply function can be defined by the user and 2to3 fixer 
doesn't make sense to be executed on Python 3 files. filter is another example 
where the call is transformed into a list comprehension by 2to3 but by the 
issue it shouldn't be done because filter is a user-defined function though 
it's a builtin in Python 2.

def filter(func, iterable):
pass

filter(lambda x: x % 2 == 0, range(10))

RefactoringTool: Refactored /tmp/foo.py
--- /tmp/foo.py (original)
+++ /tmp/foo.py (refactored)
@@ -1,4 +1,4 @@
 def filter(func, iterable):
 pass

-filter(lambda x: x % 2 == 0, range(10))
+[x for x in range(10) if x % 2 == 0]

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39683] 2to3 fix_exitfunc suggests duplicated import of atexit module

2020-02-18 Thread ilya


New submission from ilya :

Consider the following code:

import sys

def foo():
print(1)

def bar():
print(2)

if input("case: ") == 1:
sys.exitfunc = foo
else:
sys.exitfunc = bar

2to3 -f exitfunc suggests to fix it as follows:

--- a.py(original)
+++ a.py(refactored)
@@ -1,4 +1,6 @@
 import sys
+import atexit
+import atexit
 
 def foo():
 print(1)
@@ -7,6 +9,6 @@
 print(2)
 
 if input("case: ") == 1:
-sys.exitfunc = foo
+atexit.register(foo)
 else:
-sys.exitfunc = bar
+atexit.register(bar)

So it seems that it produces one import of atexit module per each use of 
sys.exitfunc.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 362245
nosy: ilya
priority: normal
severity: normal
status: open
title: 2to3 fix_exitfunc suggests duplicated import of atexit module
type: behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39682] pathlib.Path objects can be used as context managers

2020-02-18 Thread Barney Gale


New submission from Barney Gale :

`pathlib.Path` objects can be used as context managers, but this functionality 
is undocumented and makes little sense. Example:

>>> import pathlib
>>> root = pathlib.Path("/")
>>> with root:
... print(1)
... 
1
>>> with root:
... print(2)
... 
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/barney/.pyenv/versions/3.7.3/lib/python3.7/pathlib.py", line 
1028, in __enter__
self._raise_closed()
  File "/home/barney/.pyenv/versions/3.7.3/lib/python3.7/pathlib.py", line 
1035, in _raise_closed
raise ValueError("I/O operation on closed path")
ValueError: I/O operation on closed path

`Path` objects don't acquire any resources on __new__/__init__/__enter__, nor 
do they release any resources on __exit__. The whole notion of the path being 
`_closed` seems to exist purely to make impure `Path` methods unusable after 
exiting from the context manager. I can't personally think of a compelling use 
case for this, and suggest that it be removed.

--
components: Library (Lib)
messages: 362244
nosy: barneygale
priority: normal
severity: normal
status: open
title: pathlib.Path objects can be used as context managers
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39670] 2to3 fix_apply tries to fix user-defined apply function calls

2020-02-18 Thread ilya


ilya  added the comment:

> apply was a builtin in Python 2 and not sure 2to3 can differentiate between 
> user defined functions that shadow builtins. 
> https://docs.python.org/3.8/library/2to3.html#2to3fixer-apply .

> Removes usage of apply(). For example apply(function, *args, **kwargs) is 
> converted to function(*args, **kwargs).

> You can skip the apply fixer: 2to3 -x apply /tmp/bar.py

The problem is that the code is valid both for Python2 and Python3 (for 
Python3, there is even no builtin shadowing, because there is no apply builtin 
actually), and fix_apply breaks it.
I'm testing the quality of 2to3 fixers and found this issue.
I know that it's possible to switch this fixer off, but it doesn't seem to be a 
proper solution because any other bug could have the same answer.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39681] pickle.load expects an object that implements readinto

2020-02-18 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39681] pickle.load expects an object that implements readinto

2020-02-18 Thread Nathan Goldbaum


New submission from Nathan Goldbaum :

As of https://github.com/python/cpython/pull/7076, it looks like at least the C 
implementation of pickle.load expects the file argument to implement readinto:

https://github.com/python/cpython/blob/ffd9753a944916ced659b2c77aebe66a6c9fbab5/Modules/_pickle.c#L1617-L1622

This is a change in behavior relative to previous versions of Python and I 
don't see it mentioned in PEP 574 or in the pull request so I'm not sure why it 
was changed.

This change breaks some PyTorch tests (see 
https://github.com/pytorch/pytorch/issues/32289) and, at least one PyTorch 
user, although I don't have full details there.

I can try to fix this on the PyTorch side but I first want to check that this 
was an intentional change on the Python side of things.

--
components: Library (Lib)
messages: 362242
nosy: Nathan.Goldbaum
priority: normal
severity: normal
status: open
title: pickle.load expects an object that implements readinto
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39680] datetime.astimezone() method does not handle invalid local times as required by PEP 495

2020-02-18 Thread Alexander Belopolsky


New submission from Alexander Belopolsky :

Let g be a an invalid time in New York spring-forward gap:

>>> g = datetime(2020, 3, 8, 2, 30)

According to PEP 495, conversion of such instance to UTC should return a value 
that corresponds to a valid local time greater than g, but

>>> print(g.astimezone(timezone.utc).astimezone())
2020-03-08 01:30:00-05:00

Also, conversion of the same instance with fold=1 to UTC and back should 
produce a lesser time, but

>>> print(g.replace(fold=1).astimezone(timezone.utc).astimezone())
2020-03-08 03:30:00-04:00

Note that conversion to and from timestamp works correctly:

>>> print(datetime.fromtimestamp(g.timestamp()))
2020-03-08 03:30:00
>>> print(datetime.fromtimestamp(g.replace(fold=1).timestamp()))
2020-03-08 01:30:00

--
assignee: belopolsky
messages: 362241
nosy: belopolsky, p-ganssle
priority: normal
severity: normal
status: open
title: datetime.astimezone() method does not handle invalid local times as 
required by PEP 495
type: behavior
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38691] importlib: PYTHONCASEOK should be ignored when using python3 -E

2020-02-18 Thread Ido Michael


Ido Michael  added the comment:

Yes I saw those in the morning, thanks for patching it up. I will debug this 
over the weekend and will update.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39603] [security] http.client: HTTP Header Injection in the HTTP method

2020-02-18 Thread Maor Kleinberger


Maor Kleinberger  added the comment:

Hey, it's been a week since the last activity here...
Amir, if you are not working on it I'd be glad to work on it as well :)

--
nosy: +kmaork

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28859] os.path.ismount sometimes raises FileNotFoundError on Windows

2020-02-18 Thread Steve Dower


Steve Dower  added the comment:

> I am going to think maybe it was the "os.path.ismount" command that is 
> causing the issue. Does the file exist?

If the file does not exist, it is definitely not a mount point. So the function 
should return False instead of raising an error.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9056] Adding additional level of bookmarks and section numbers in python pdf documents.

2020-02-18 Thread Julien Palard


Julien Palard  added the comment:

Merged Cheryl's patch (thanks Cheryl!).

pengyu.ut if you want to test it you'll be able to see generated PDF in a 
maximum of 24h from now on [1].

Don't hesitate to ask if you need them for 3.8 we can backport it.

[1]: https://docs.python.org/dev/

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39555] test_distutils fails for Windows debug build

2020-02-18 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset d77e77116fa7a9fc85be1d9f417c7e9e33fe1296 by Miss Islington (bot) 
in branch '3.8':
bpo-39555: Fix distutils test to handle _d suffix on Windows debug build 
(GH-18357) (GH-18548)
https://github.com/python/cpython/commit/d77e77116fa7a9fc85be1d9f417c7e9e33fe1296


--
nosy: +petr.viktorin

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39662] Characters are garbled when displaying Byte data

2020-02-18 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm going to close this. But if you have additional information that points to 
this being a bug in python, we can re-open it.

--
resolution:  -> not a bug
stage:  -> resolved
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34822] Simplify AST for slices

2020-02-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

No, this PR does not change the Python syntax. It only changes the AST 
representation.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39679] functools: singledispatchmethod doesn't work with classmethod

2020-02-18 Thread Viktor Roytman


New submission from Viktor Roytman :

I couldn't get the example given for the interaction between 
@singledispatchmethod and @classmethod to work 
https://docs.python.org/3/library/functools.html?highlight=singledispatch#functools.singledispatchmethod

from functools import singledispatchmethod


class Negator:
@singledispatchmethod
@classmethod
def neg(cls, arg):
raise NotImplementedError("Cannot negate a")

@neg.register
@classmethod
def _(cls, arg: int):
return -arg

@neg.register
@classmethod
def _(cls, arg: bool):
return not arg


if __name__ == "__main__":
print(Negator.neg(0))
print(Negator.neg(False))

Leads to

$ python -m bad_classmethod_as_documented
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
  File "/home/viktor/scratch/bad_classmethod_as_documented.py", line 4, in 

class Negator:
  File "/home/viktor/scratch/bad_classmethod_as_documented.py", line 12, in 
Negator
def _(cls, arg: int):
  File "/usr/lib/python3.8/functools.py", line 906, in register
return self.dispatcher.register(cls, func=method)
  File "/usr/lib/python3.8/functools.py", line 848, in register
raise TypeError(
TypeError: Invalid first argument to `register()`: . Use either `@register(some_class)` or plain `@register` on an 
annotated function.

Curiously, @staticmethod does work, but not as documented (don't decorate the 
actual implementations):

from functools import singledispatchmethod


class Negator:
@singledispatchmethod
@staticmethod
def neg(arg):
raise NotImplementedError("Cannot negate a")

@neg.register
def _(arg: int):
return -arg

@neg.register
def _(arg: bool):
return not arg


if __name__ == "__main__":
print(Negator.neg(0))
print(Negator.neg(False))

Leads to

$ python -m good_staticmethod
0
True

Removing @classmethod from the implementation methods doesn't work, though

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
  File "/home/viktor/scratch/bad_classmethod_alternative.py", line 20, in 

print(Negator.neg(0))
  File "/usr/lib/python3.8/functools.py", line 911, in _method
return method.__get__(obj, cls)(*args, **kwargs)
TypeError: _() missing 1 required positional argument: 'arg'

--
components: Library (Lib)
messages: 362233
nosy: Viktor Roytman
priority: normal
severity: normal
status: open
title: functools: singledispatchmethod doesn't work with classmethod
type: behavior
versions: Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39572] [typing] TypedDict's 'total' argument is undocumented

2020-02-18 Thread Ananthakrishnan


Change by Ananthakrishnan :


--
keywords: +patch
pull_requests: +17935
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/18554

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39572] [typing] TypedDict's 'total' argument is undocumented

2020-02-18 Thread Ananthakrishnan


Ananthakrishnan  added the comment:

yes,I'm interested.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39572] [typing] TypedDict's 'total' argument is undocumented

2020-02-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

There's no __total__ argument, but there is a __total__ attribute. There are 
also (new in 3.9) __required_keys__ and __total_keys__ attributes.

Are you interested in submitting a PR with the needed doc changes?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39635] One paragraph of the doc is not translated in French

2020-02-18 Thread Julien Palard

Julien Palard  added the comment:

This has been resolved in https://github.com/python/python-docs-fr/pull/1153 I 
bet Frédéric is the author so thank you for the PR.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39572] [typing] TypedDict's 'total' argument is undocumented

2020-02-18 Thread Ananthakrishnan


Ananthakrishnan  added the comment:

It will be usefull if we document _total_ argument also.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39572] [typing] TypedDict's 'total' argument is undocumented

2020-02-18 Thread Guido van Rossum


Change by Guido van Rossum :


--
keywords: +easy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39572] [typing] TypedDict's 'total' argument is undocumented

2020-02-18 Thread Ananthakrishnan


Ananthakrishnan  added the comment:

https://stackoverflow.com/questions/58427394/what-is-the-meaning-of-total-dunder-attribute-in-python-3

questions about this.

--
nosy: +Ananthakrishnan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38691] importlib: PYTHONCASEOK should be ignored when using python3 -E

2020-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

> Tests fail on macOS: https://buildbot.python.org/all/#/builders/275/builds/249

Tests are run with "./python.exe  ./Tools/scripts/run_tests.py -j 1 -u all -W 
--slowest --fail-env-changed --timeout=900 -j2 --junit-xml test-results.xml" 
which runs tests with "./python.exe -E": ignore PYTHON* environment variables. 
Maybe the test should just take that in account.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38691] importlib: PYTHONCASEOK should be ignored when using python3 -E

2020-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

I'm unable to debug the issue on macOS. I prepared PR 18553 to revert the 
change, just to give more time to fix the issue. It's to repair the CI, so we 
can notice other regressions.

--
keywords:  -newcomer friendly
title: [easy] importlib: PYTHONCASEOK should be ignored when using python3 -E 
-> importlib: PYTHONCASEOK should be ignored when using python3 -E

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38691] [easy] importlib: PYTHONCASEOK should be ignored when using python3 -E

2020-02-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17934
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/18553

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2020-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

PR 18552 adds a section to What's New In Python 3.9 to strongly advice to check 
for DeprecationWarning in your Python projects.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2020-02-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17933
pull_request: https://github.com/python/cpython/pull/18552

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39635] One paragraph of the doc is not translated in French

2020-02-18 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests:  -17932

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39635] One paragraph of the doc is not translated in French

2020-02-18 Thread Ananthakrishnan


Change by Ananthakrishnan :


--
keywords: +patch
pull_requests: +17932
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/1153

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34822] Simplify AST for slices

2020-02-18 Thread Vedran Čačić

Vedran Čačić  added the comment:

I wrote some AST analyzers, and this would have simplified my code. So I 
welcome it. :-)

However, it means people might be tempted to write 

a[b:c, d]asa[(b:c, d)]

(or at least expect it to work -- same as `a[b, c]` can now be written as 
`a[(b, c)]`). We aren't going to allow this?

--
nosy: +veky

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39648] Update math.gcd() to accept "n" arguments.

2020-02-18 Thread Ananthakrishnan


Ananthakrishnan  added the comment:

Can I put together a PR for this issue?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25988] collections.abc.Indexable

2020-02-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset af5ee3ff610377ef446c2d88bbfcbb3dffaaf0c9 by Victor Stinner in 
branch 'master':
bpo-39674: Revert "bpo-25988: Do not expose abstract collection classes in the 
collections module. (GH-10596)" (GH-18545)
https://github.com/python/cpython/commit/af5ee3ff610377ef446c2d88bbfcbb3dffaaf0c9


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2020-02-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset af5ee3ff610377ef446c2d88bbfcbb3dffaaf0c9 by Victor Stinner in 
branch 'master':
bpo-39674: Revert "bpo-25988: Do not expose abstract collection classes in the 
collections module. (GH-10596)" (GH-18545)
https://github.com/python/cpython/commit/af5ee3ff610377ef446c2d88bbfcbb3dffaaf0c9


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2020-02-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

Yes please.

I have one exception. I f we manage to get the new parser (pegen) in, we have 
to remove the old parser module.

--
nosy: +gvanrossum

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39678] RFC improve readability of _queue_management_worker for ProcessPoolExecutor

2020-02-18 Thread Thomas Moreau


Change by Thomas Moreau :


--
keywords: +patch
pull_requests: +17931
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18551

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-02-18 Thread miss-islington


miss-islington  added the comment:


New changeset 6e35da976370e7c2e028165c65d7d7d42772a71f by Petr Viktorin in 
branch 'master':
bpo-37207: Use vectorcall for range() (GH-18464)
https://github.com/python/cpython/commit/6e35da976370e7c2e028165c65d7d7d42772a71f


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39678] RFC improve readability of _queue_management_worker for ProcessPoolExecutor

2020-02-18 Thread Thomas Moreau


New submission from Thomas Moreau :

As discussed in GH#17670, the the `_queue_management_worker` function has grown 
quite long and complicated.
It could be turned into an object with a bunch of short and readable helper 
methods.

--
components: Library (Lib)
messages: 362218
nosy: pitrou, tomMoral
priority: normal
severity: normal
status: open
title: RFC improve readability of _queue_management_worker for 
ProcessPoolExecutor
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37921] Improve zipfile: add support for symlinks

2020-02-18 Thread Henning von Bargen


Henning von Bargen  added the comment:

If I understand correctly, 
this bug is about supporting symlinks on *creating* ZIP files.

Please see also https://bugs.python.org/issue27318 for a proposal to support 
symlinks while *unpacking* ZIP files.

Maybe a preserve_symlinks optional argument should be added to the `extract` 
and `extractall` method as well (the same argument name is used in 
`distutils.dir_util.copy_tree`).

Anyway, I think symlink support should be added for packing *and* unpacking or 
not at all.

--
nosy: +Henning.von.Bargen

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32352] `inspect.getfullargspec` doesn't work fine for some builtin callable objects

2020-02-18 Thread thautwarm


Change by thautwarm :


--
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39573] Make PyObject an opaque structure in the limited C API

2020-02-18 Thread Andy Lester


Andy Lester  added the comment:

All I'm saying is that I think Py_IS_TYPE is a great idea, and that Py_IS_TYPE 
should take const arguments, since its arguments are not modified.  If you 
think that should go in a different ticket, then I can make that happen.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39677] 3.6+ documentation for MAKE_FUNCTION

2020-02-18 Thread thautwarm


Change by thautwarm :


--
pull_requests: +17930
pull_request: https://github.com/python/cpython/pull/18550

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39677] 3.6+ documentation for MAKE_FUNCTION

2020-02-18 Thread thautwarm


Change by thautwarm :


--
keywords: +patch
pull_requests: +17929
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/18549

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39611] PyVectorcall_NARGS(): change return type to Py_ssize_t

2020-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

Alright, I was confused by how PyVectorcall_NARGS() is supposed to be used.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37373] Configuration of windows event loop for libraries

2020-02-18 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39432] Distutils generates the wrong export symbol for unicode module names

2020-02-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17928
pull_request: https://github.com/python/cpython/pull/18548

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39676] test_shutil fails with OSError: [Errno 28] No space left on device on "PPC64LE Fedora Stable LTO + PGO 3.x" buildbot

2020-02-18 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +cstratak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39555] test_distutils fails for Windows debug build

2020-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

This issue is related to bpo-39432.

commit 9538bc9185e934bee2bd5ae2cda2b2e92a61906d
Author: Stefan Behnel 
Date:   Tue Feb 4 16:24:30 2020 +0100

bpo-39432: Implement PEP-489 algorithm for non-ascii "PyInit_*" symbol 
names in distutils (GH-18150)



Make it export the correct init symbol also on Windows.



https://bugs.python.org/issue39432

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39669] macOS test failures

2020-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

It's bpo-38691. Let's discuss it there.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> [easy] importlib: PYTHONCASEOK should be ignored when using 
python3 -E

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39573] Make PyObject an opaque structure in the limited C API

2020-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

> If we can keep functions that don't modify the object to accept const 
> PyObject* it will help make things safer in the long run.

In my experience, trying to add "const" is quite painful, since the "const" has 
to be propagated to all functions called by the modified function. Python never 
used "const" with "PyObject*" because they are *so many* functions which really 
modify objects on purpose.

I don't see how adding "const" would help this issue "Make PyObject an opaque 
structure in the limited C API". If you consider that something should be 
changed, please open a *separated* issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39677] 3.6+ documentation for MAKE_FUNCTION

2020-02-18 Thread thautwarm


thautwarm  added the comment:

Okay, I'll make a PR. It's okay because users will always check docs of version 
3 instead of a specific version like 3.6.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38860] GenericPyCData_new does not invoke new or init

2020-02-18 Thread Rebecca Morgan


Rebecca Morgan  added the comment:

I would still be interested in this, with some clarity on the testing/expected 
behavior.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39555] test_distutils fails for Windows debug build

2020-02-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17927
pull_request: https://github.com/python/cpython/pull/18546

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39555] test_distutils fails for Windows debug build

2020-02-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17926
pull_request: https://github.com/python/cpython/pull/18548

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39673] Map errno==ETIME to TimeoutError

2020-02-18 Thread Eric V. Smith


Change by Eric V. Smith :


--
stage:  -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39673] Map errno==ETIME to TimeoutError

2020-02-18 Thread Eric V. Smith


Change by Eric V. Smith :


--
title: TimeoutError -> Map errno==ETIME to TimeoutError
type: behavior -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39677] 3.6+ documentation for MAKE_FUNCTION

2020-02-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Agree. Do you want to provide a PR?

Although it may be too later for 3.6 which only takes security fixes.

--
keywords: +easy
nosy: +serhiy.storchaka
stage:  -> needs patch
versions: +Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39677] 3.6+ documentation for MAKE_FUNCTION

2020-02-18 Thread thautwarm


New submission from thautwarm :

LINK: 
https://docs.python.org/3.6/library/dis.html?highlight=bytecode#opcode-MAKE_FUNCTION

To avoid being confusing, MAKE_FUNCTION(argc) shall be MAKE_FUNCTION(flag), 
since 3.6 the operand of MAKE_FUNCTION never means `argcount`.

--
assignee: docs@python
components: Documentation
messages: 362208
nosy: docs@python, thautwarm
priority: normal
severity: normal
status: open
title: 3.6+ documentation for MAKE_FUNCTION
type: enhancement
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39432] Distutils generates the wrong export symbol for unicode module names

2020-02-18 Thread Stefan Behnel


Change by Stefan Behnel :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39432] Distutils generates the wrong export symbol for unicode module names

2020-02-18 Thread Stefan Behnel


Stefan Behnel  added the comment:


New changeset 5bf58cef151249f1cca92166d1b70693348da9d8 by Miss Islington (bot) 
in branch '3.8':
bpo-39432: Implement PEP-489 algorithm for non-ascii "PyInit_*" symbol names in 
distutils (GH-18150) (GH-18546)
https://github.com/python/cpython/commit/5bf58cef151249f1cca92166d1b70693348da9d8


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36347] Renaming the constants for the .flags of PyMemberDef

2020-02-18 Thread miss-islington


miss-islington  added the comment:


New changeset 24bba8cf5b8db25c19bcd1d94e8e356874d1c723 by Jeroen Demeyer in 
branch 'master':
bpo-36347: stop using RESTRICTED constants (GH-12684)
https://github.com/python/cpython/commit/24bba8cf5b8db25c19bcd1d94e8e356874d1c723


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39673] TimeoutError

2020-02-18 Thread YoSTEALTH


YoSTEALTH  added the comment:

If nothing else, it could be a feature of next Python release as its 
appropriate that `TimeoutError` catches both `ETIME` and `ETIMEDOUT`.

--
versions: +Python 3.9 -Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39673] TimeoutError

2020-02-18 Thread Eric V. Smith


Eric V. Smith  added the comment:

> These are both timeout errors but only `ETIMEDOUT` is accounted for?

Yes, only ETIMEDOUT is accounted for in Objects/exceptions.c. There's precedent 
for mapping multiple errnos to the same exception:

ADD_ERRNO(BlockingIOError, EAGAIN);
ADD_ERRNO(BlockingIOError, EALREADY);
ADD_ERRNO(BlockingIOError, EINPROGRESS);
ADD_ERRNO(BlockingIOError, EWOULDBLOCK);

You should probably raise this on python-ideas. I don't know if ETIME has some 
other accepted meaning. It's not mapped to any other exception, so it could be 
easily added. The only thing it would affect are people who are catching 
OSError and TimeoutError and are expecting ETIME to give an OSError, which 
seems a pretty niche case. Or I guess people who only catch TimeoutError and 
want to not catch the case where errno==ETIME.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39676] test_shutil fails with OSError: [Errno 28] No space left on device on "PPC64LE Fedora Stable LTO + PGO 3.x" buildbot

2020-02-18 Thread STINNER Victor


New submission from STINNER Victor :

PPC64LE Fedora Stable LTO + PGO 3.x:
https://buildbot.python.org/all/#/builders/449/builds/31

Example:

==
ERROR: test_big_chunk (test.test_shutil.TestZeroCopySendfile)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.lto-pgo/build/Lib/test/test_shutil.py",
 line 2405, in test_big_chunk
shutil._fastcopy_sendfile(src, dst)
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.lto-pgo/build/Lib/shutil.py",
 line 163, in _fastcopy_sendfile
raise err from None
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.lto-pgo/build/Lib/shutil.py",
 line 149, in _fastcopy_sendfile
sent = os.sendfile(outfd, infd, offset, blocksize)
OSError: [Errno 28] No space left on device: '@test_3252264_tmp' -> 
'@test_3252264_tmp2'

--
components: Tests
messages: 362203
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_shutil fails with OSError: [Errno 28] No space left on device on 
"PPC64LE Fedora Stable LTO + PGO 3.x" buildbot
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38691] [easy] importlib: PYTHONCASEOK should be ignored when using python3 -E

2020-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

Tests fail on macOS:
https://buildbot.python.org/all/#/builders/275/builds/249

I reopen the issue. The issue should be fixed soon, or the change will be 
reverted to repair buildobts:
https://pythondev.readthedocs.io/ci.html#revert-on-fail

==
FAIL: test_case_insensitivity 
(test.test_importlib.extension.test_case_sensitivity.Frozen_ExtensionModuleCaseSensitivityTest)
--
Traceback (most recent call last):
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/test/test_importlib/extension/test_case_sensitivity.py",
 line 36, in test_case_insensitivity
self.assertTrue(hasattr(loader, 'load_module'))
AssertionError: False is not true

==
FAIL: test_case_insensitivity 
(test.test_importlib.extension.test_case_sensitivity.Source_ExtensionModuleCaseSensitivityTest)
--
Traceback (most recent call last):
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/test/test_importlib/extension/test_case_sensitivity.py",
 line 36, in test_case_insensitivity
self.assertTrue(hasattr(loader, 'load_module'))
AssertionError: False is not true

==
FAIL: test_insensitive 
(test.test_importlib.source.test_case_sensitivity.Frozen_CaseSensitivityTestPEP302)
--
Traceback (most recent call last):
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/test/test_importlib/source/test_case_sensitivity.py",
 line 57, in test_insensitive
self.assertIsNotNone(insensitive)
AssertionError: unexpectedly None

==
FAIL: test_insensitive 
(test.test_importlib.source.test_case_sensitivity.Frozen_CaseSensitivityTestPEP451)
--
Traceback (most recent call last):
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/test/test_importlib/source/test_case_sensitivity.py",
 line 57, in test_insensitive
self.assertIsNotNone(insensitive)
AssertionError: unexpectedly None

==
FAIL: test_insensitive 
(test.test_importlib.source.test_case_sensitivity.Source_CaseSensitivityTestPEP302)
--
Traceback (most recent call last):
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/test/test_importlib/source/test_case_sensitivity.py",
 line 57, in test_insensitive
self.assertIsNotNone(insensitive)
AssertionError: unexpectedly None

==
FAIL: test_insensitive 
(test.test_importlib.source.test_case_sensitivity.Source_CaseSensitivityTestPEP451)
--
Traceback (most recent call last):
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/test/test_importlib/source/test_case_sensitivity.py",
 line 57, in test_insensitive
self.assertIsNotNone(insensitive)
AssertionError: unexpectedly None

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2020-02-18 Thread Jason Madden


Change by Jason Madden :


--
nosy: +jmadden

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39673] TimeoutError

2020-02-18 Thread YoSTEALTH


YoSTEALTH  added the comment:

I am on Linux 5.5.2-1-MANJARO

>>> sorted(errno.errorcode.items())
[(1, 'EPERM'), (2, 'ENOENT'), (3, 'ESRCH'), (4, 'EINTR'), (5, 'EIO'), (6, 
'ENXIO'), (7, 'E2BIG'), (8, 'ENOEXEC'), (9, 'EBADF'), (10, 'ECHILD'), (11, 
'EAGAIN'), (12, 'ENOMEM'), (13, 'EACCES'), (14, 'EFAULT'), (15, 'ENOTBLK'), 
(16, 'EBUSY'), (17, 'EEXIST'), (18, 'EXDEV'), (19, 'ENODEV'), (20, 'ENOTDIR'), 
(21, 'EISDIR'), (22, 'EINVAL'), (23, 'ENFILE'), (24, 'EMFILE'), (25, 'ENOTTY'), 
(26, 'ETXTBSY'), (27, 'EFBIG'), (28, 'ENOSPC'), (29, 'ESPIPE'), (30, 'EROFS'), 
(31, 'EMLINK'), (32, 'EPIPE'), (33, 'EDOM'), (34, 'ERANGE'), (35, 'EDEADLOCK'), 
(36, 'ENAMETOOLONG'), (37, 'ENOLCK'), (38, 'ENOSYS'), (39, 'ENOTEMPTY'), (40, 
'ELOOP'), (42, 'ENOMSG'), (43, 'EIDRM'), (44, 'ECHRNG'), (45, 'EL2NSYNC'), (46, 
'EL3HLT'), (47, 'EL3RST'), (48, 'ELNRNG'), (49, 'EUNATCH'), (50, 'ENOCSI'), 
(51, 'EL2HLT'), (52, 'EBADE'), (53, 'EBADR'), (54, 'EXFULL'), (55, 'ENOANO'), 
(56, 'EBADRQC'), (57, 'EBADSLT'), (59, 'EBFONT'), (60, 'ENOSTR'), (61, 
'ENODATA'), (62, 'ETIME'), (63, 'ENOSR'), (64, 'ENONET'), (65, 'ENOPKG')
 , (66, 'EREMOTE'), (67, 'ENOLINK'), (68, 'EADV'), (69, 'ESRMNT'), (70, 
'ECOMM'), (71, 'EPROTO'), (72, 'EMULTIHOP'), (73, 'EDOTDOT'), (74, 'EBADMSG'), 
(75, 'EOVERFLOW'), (76, 'ENOTUNIQ'), (77, 'EBADFD'), (78, 'EREMCHG'), (79, 
'ELIBACC'), (80, 'ELIBBAD'), (81, 'ELIBSCN'), (82, 'ELIBMAX'), (83, 
'ELIBEXEC'), (84, 'EILSEQ'), (85, 'ERESTART'), (86, 'ESTRPIPE'), (87, 
'EUSERS'), (88, 'ENOTSOCK'), (89, 'EDESTADDRREQ'), (90, 'EMSGSIZE'), (91, 
'EPROTOTYPE'), (92, 'ENOPROTOOPT'), (93, 'EPROTONOSUPPORT'), (94, 
'ESOCKTNOSUPPORT'), (95, 'ENOTSUP'), (96, 'EPFNOSUPPORT'), (97, 
'EAFNOSUPPORT'), (98, 'EADDRINUSE'), (99, 'EADDRNOTAVAIL'), (100, 'ENETDOWN'), 
(101, 'ENETUNREACH'), (102, 'ENETRESET'), (103, 'ECONNABORTED'), (104, 
'ECONNRESET'), (105, 'ENOBUFS'), (106, 'EISCONN'), (107, 'ENOTCONN'), (108, 
'ESHUTDOWN'), (109, 'ETOOMANYREFS'), (110, 'ETIMEDOUT'), (111, 'ECONNREFUSED'), 
(112, 'EHOSTDOWN'), (113, 'EHOSTUNREACH'), (114, 'EALREADY'), (115, 
'EINPROGRESS'), (116, 'ESTALE'), (117, 'EUCLEAN'), (118,
  'ENOTNAM'), (119, 'ENAVAIL'), (120, 'EISNAM'), (121,
 'EREMOTEIO'), (122, 'EDQUOT'), (123, 'ENOMEDIUM'), (124, 'EMEDIUMTYPE'), (125, 
'ECANCELED'), (126, 'ENOKEY'), (127, 'EKEYEXPIRED'), (128, 'EKEYREVOKED'), 
(129, 'EKEYREJECTED'), (130, 'EOWNERDEAD'), (131, 'ENOTRECOVERABLE'), (132, 
'ERFKILL')]


Its an automated process the value is return by the C/kernel. I suppose its 
calling `ETIME`

ETIME - Timer expired (POSIX.1 (XSI STREAMS option)).
  (POSIX.1 says "STREAM ioctl(2) timeout".)
ETIMEDOUT - Connection timed out (POSIX.1-2001).

These are both timeout errors but only `ETIMEDOUT` is accounted for?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

2020-02-18 Thread Ananthakrishnan


Change by Ananthakrishnan :


--
pull_requests: +17925
pull_request: https://github.com/python/cpython/pull/18547

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39675] forked process in multiprocessing does not honour atexit

2020-02-18 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
components: +Library (Lib)
type:  -> behavior
versions: +Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39675] forked process in multiprocessing does not honour atexit

2020-02-18 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
assignee:  -> pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39673] TimeoutError

2020-02-18 Thread Eric V. Smith


Eric V. Smith  added the comment:

Ah, I see.

What platform are you on, and what's the value of errno.ETIMEDOUT?

On cygwin I get:
>>> errno.ETIMEDOUT
116

On a native Windows build I get:
>>> errno.ETIMEDOUT
10060

and on Fedora I get:
>>> errno.ETIMEDOUT
110

If you use errno.ETIMEDOUT instead of 62, do you get different behavior?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39611] PyVectorcall_NARGS(): change return type to Py_ssize_t

2020-02-18 Thread Petr Viktorin


Petr Viktorin  added the comment:

Closing; please reopen if we're somehow misunderstanding each other :)

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39611] PyVectorcall_NARGS(): change return type to Py_ssize_t

2020-02-18 Thread Petr Viktorin

Petr Viktorin  added the comment:

The current return type already is Py_ssize_t, exactly for the reason you 
mention – compatibility with all other "argument count" values in Python. (It 
would be more correct to use unsigned, but that ship has sailed.)

The *argument* type is unsigned size_t, though: unsigned is the correct type 
for for bit fields. Also, the "nargsf" value should never be directly used as 
argument count; making it a different type tends to trigger nice compiler 
warnings.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39432] Distutils generates the wrong export symbol for unicode module names

2020-02-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17924
stage: backport needed -> patch review
pull_request: https://github.com/python/cpython/pull/18546

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39245] Public API for Vectorcall (PEP 590)

2020-02-18 Thread Petr Viktorin


Change by Petr Viktorin :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39675] forked process in multiprocessing does not honour atexit

2020-02-18 Thread gaborbernat


New submission from gaborbernat :

I've talked with Pablo about this in person, and as advised opening the issue 
here now. 

I've discovered that forked processes do not honour atexit registrations. See 
the following example code:

from multiprocessing import Process, set_start_method
import time
import os
import atexit


def cleanup():
print(f"cleanup {os.getpid()}")


atexit.register(cleanup)


def run():
time.sleep(0.1)
print(f"process done {os.getpid()}")
# atexit._run_exitfuncs()


if __name__ == "__main__":
set_start_method("fork")
process = Process(target=run)
process.start()
process.join()
print("app finished")

In case of a forked process childs the atexit is never executed (note it works 
if I ran them manually at the end of the child process; so they're registered 
correctly). Switching to spawn method makes it work as expected. The behaviour 
is the same even if you call register within the child process (as opposed to 
being inherited during forking). Also found this StackOverflow question that 
mentions this https://stackoverflow.com/a/26476585. At the very least the 
documentation should explain this; though I'd expect atexit to be called before 
finalization of the fork processes (assuming the child process exits with 0 
exit code). d

--
messages: 362197
nosy: davin, gaborbernat, pablogsal, pitrou
priority: normal
severity: normal
status: open
title: forked process in multiprocessing does not honour atexit

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25988] collections.abc.Indexable

2020-02-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17923
pull_request: https://github.com/python/cpython/pull/18545

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2020-02-18 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +17922
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18545

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2020-02-18 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2020-02-18 Thread STINNER Victor


New submission from STINNER Victor :

Following discussion on python-dev, I propose to revert the removal of a few 
deprecated functions to keep them in Python 3.9, and only remove them in Python 
3.10. Please see the following email for the longer rationale, and the 
discussion for further details:

https://mail.python.org/archives/list/python-...@python.org/thread/EYLXCGGJOUMZSE5X35ILW3UNTJM3MCRE/

With Python 3.8, it was possible to have a single code base working on Python 
2.7 and 3.8. Some functions emits DeprecationWarning, but these warnings are 
ignored (silent) by default. With removed deprecated functions in Python 3.9, 
*new* code is required to support Python 2.7. The problem is that Python 2.7 is 
no longer supported. Adding new code to support Python 2.7 sounds painful. 
Dropping Python 2.7 support isn't free. Projects have to drop Python 2 code, 
drop CI tests on Python 2, warn users, etc.

The idea is to give maintainers one more year (until Python 3.10) to organize 
their project to schedule properly the removal of Python 2 support. The first 
motivation is to ease adoption of Python 3.9.

--

I propose to start with reverting the removal of collections aliases to 
Abstract Base Classes (ABC) like collections.Mapping alias to 
collections.abc.Mapping. Removing these aliases is the change which caused most 
issues when testing Python projects on Python 3.9.

I also propose to modify the What's New In Python 3.9 document to strongly 
suggest to test your applications with -W default or even -W error to see 
DeprecationWarning and PendingDeprecationWarning.

--
components: Library (Lib)
messages: 362196
nosy: vstinner
priority: normal
severity: normal
status: open
title: Keep deprecated features in Python 3.9 to ease migration from Python 
2.7, but remove in Python 3.10
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-02-18 Thread miss-islington


miss-islington  added the comment:


New changeset 5d38517aa1836542a5417b724c093bcb245f0f47 by Hai Shi in branch 
'master':
bpo-1635741: Port _bz2 extension module to multiphase initialization(PEP 489) 
(GH-18050)
https://github.com/python/cpython/commit/5d38517aa1836542a5417b724c093bcb245f0f47


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26967] argparse: allow_abbrev=False stops -vv from working

2020-02-18 Thread miss-islington


miss-islington  added the comment:


New changeset e412cbba52e7cf6699720d99a4b88baef92db7b2 by Miss Islington (bot) 
in branch '3.8':
[3.8] bpo-39546: argparse: Honor allow_abbrev=False for specified prefix_chars 
(GH-18337) (GH-18543)
https://github.com/python/cpython/commit/e412cbba52e7cf6699720d99a4b88baef92db7b2


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39546] argparse: allow_abbrev=False is ignored for alternative prefix characters

2020-02-18 Thread miss-islington


miss-islington  added the comment:


New changeset e412cbba52e7cf6699720d99a4b88baef92db7b2 by Miss Islington (bot) 
in branch '3.8':
[3.8] bpo-39546: argparse: Honor allow_abbrev=False for specified prefix_chars 
(GH-18337) (GH-18543)
https://github.com/python/cpython/commit/e412cbba52e7cf6699720d99a4b88baef92db7b2


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39673] TimeoutError

2020-02-18 Thread YoSTEALTH


YoSTEALTH  added the comment:

First example prints
# Failed: [Errno 62] Timer expired

Second example prints
# Success: [Errno 11] Resource temporarily unavailable

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >