[issue42422] Py_Decref on value crash the interpreter in Python/ceval.c:1104

2020-11-20 Thread Sofian Brabez


Sofian Brabez  added the comment:

Linux, FreeBSD and MacOSX crash reports and backtraces joined in the zip.

Contributor Agreement 2020-09-23 signed.

--
Added file: https://bugs.python.org/file49611/crash-report-txt.zip

___
Python tracker 

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



[issue42422] Py_Decref on value crash the interpreter in Python/ceval.c:1104

2020-11-20 Thread Sofian Brabez


New submission from Sofian Brabez :

This PoC is causing a local crash of python interpreters version 
2.7,3.6,3.7,3.8 and 3.9.

By creating a code object of size 0 with a POP_TOP opcode, in Python/ceval.c 
the call to Py_DECREF(value) on a NULL pointer lead to a segmentation fault of 
the python interpreter.

It was tested on all python3.x versions against a fresh compilation of a git 
clone github.com/python/cpython.git on branches and master. You need to adapt 
the code() constructor because the parameters are different across versions but 
crash remains.

I'm just covering the version 3.7 in following text

$ git clone --depth 1 https://github.com/python/cpython.git
$ git checkout -b 3.7 origin/3.7
$ export CFLAGS+="-g -O0"
$ ./configure
$ make
$ ./python -V
Python 3.7.9+
$ ./python -c 'import sys; print(sys.version)'
3.7.9+ (heads/3.7-dirty:08ba61dade, Nov 21 2020, 04:57:20) 
[Clang 10.0.1 (g...@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611a
$ ./python crash.py

Running the python3.7 execution into gdb, helped me to locate the crash for 
python3.7 https://github.com/python/cpython/blob/3.7/Python/ceval.c#L1104

$ gdb --batch --silent ./python -ex 'r crash.py'
Program received signal SIGSEGV, Segmentation fault.
0x0033873a in _PyEval_EvalFrameDefault (f=0x800bdda00, throwflag=0) at 
Python/ceval.c:1104
1104Py_DECREF(value);

Also I have executed the PoC on different platforms Linux, FreeBSD and MacOSX. 
The behaviour is the same and SIGSEGV the interpreter.

I have located the issue in the source code but I'm wondering what will be the 
best solution to fix it? Python developers should know better, I am open to 
your advices and suggestions.

I have noticed that one assertion handle this case (in master) 
https://github.com/python/cpython/blob/master/Python/ceval.c#L1430 but most of 
the interpreters are built without --with-assertions enabled, so the crash will 
still persist.

More details on this gist 
https://gist.github.com/sbz/267d35de5766c53835c5c4ef45b18705

I think the python interpreter shouldn't crash and handle properly this edge 
case.

--
components: Interpreter Core
files: crash.py
messages: 381527
nosy: sbz
priority: normal
severity: normal
status: open
title: Py_Decref on value crash the interpreter in Python/ceval.c:1104
type: crash
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49610/crash.py

___
Python tracker 

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



[issue42421] Native open failed to create a file on windows10 when colon exists in the name

2020-11-20 Thread Eryk Sun


Eryk Sun  added the comment:

> 'FocalMix: Semi-Supervised Learning for 3D Medical Image Detection.pdf'

In a filesystem that supports file streams [1], such as NTFS or ReFS, the above 
name refers to a $DATA stream named " Semi-Supervised Learning for 3D Medical 
Image Detection.pdf" in a file name "FocalMix".

Filesystems that do not support file streams may allow colon in filenames, 
regardless of its reserved status in the API. FAT filesystems (e.g. FAT32, 
exFAT) disallow colon in filenames. But the VirtualBox shared-folder filesystem 
(redirector) allows it. Even if colon is allowed by a particular filesystem, I 
strongly advise that you never use it in filenames, considering the problems 
with moving the file to an NTFS drive.

You also need to be vigilant about using DOS device names (e.g. "con", "nul:", 
"com1.txt", etc) in filenames. Creating or opening them may succeed, but 
probably not in the way that you expect. For example, if you open 
r"C:\Temp\nul.txt" for writing, you're actually opening the r"\\.\NUL" device, 
and all of the data written is simply thrown away without error.

---

[1] https://docs.microsoft.com/en-us/windows/win32/fileio/file-streams

--
nosy: +eryksun

___
Python tracker 

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



[issue42421] Native open failed to create a file on windows10 when colon exists in the name

2020-11-20 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is standard Windows behaviour, and goes back to DOS days. Reserved 
filenames and illegal characters are described here:

https://docs.microsoft.com/en-gb/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN

If the Windows OS and file system does not allow a colon in the file name, 
there is nothing Python can do to change that.

--
nosy: +steven.daprano
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



[issue42421] Native open failed to create a file on windows10 when colon exists in the name

2020-11-20 Thread 嘉乐君子

New submission from 嘉乐君子 :

with open('./pdfs/' + pdf_name, 'wb') as fo:
fo.write(data)

On Windows10, the native 'open' in Python3.7 failed to create a file if the 
name contains colon, such as 'FocalMix: Semi-Supervised Learning for 3D Medical 
Image Detection.pdf'.

--
components: IO
messages: 381524
nosy: chenhaoran1991
priority: normal
severity: normal
status: open
title: Native open failed to create a file on windows10 when colon exists in 
the name
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue42419] Typo in "what's new in Python 3.9"

2020-11-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset ed0201805c036e4bc26670ec7ccffefb8e219f78 by Miss Islington (bot) 
in branch '3.9':
bpo-42419: Correct 'deprecatations' is What's New 3.9 (GH-23421) (GH-23435)
https://github.com/python/cpython/commit/ed0201805c036e4bc26670ec7ccffefb8e219f78


--

___
Python tracker 

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



[issue42407] Grammatical typo in multiprocessing doc

2020-11-20 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
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



[issue42419] Typo in "what's new in Python 3.9"

2020-11-20 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +22327
pull_request: https://github.com/python/cpython/pull/23435

___
Python tracker 

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



[issue42419] Typo in "what's new in Python 3.9"

2020-11-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset aa3a3521cef3998d4f9e7f7ff721163b6e3e5f39 by Quentin Hibon in 
branch 'master':
bpo-42419: Correct 'deprecatations' is What's New 3.9 (GH-23421)
https://github.com/python/cpython/commit/aa3a3521cef3998d4f9e7f7ff721163b6e3e5f39


--
nosy: +terry.reedy

___
Python tracker 

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



[issue42414] unable to document fields of dataclass

2020-11-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Documenting dataclass fields strikes me as a reasonable request.  Since most 
most field values cannot have a  .__doc__ attribute...

> It could be stored in the dataclass-specific data attached to a class, 

The obvious place.

> but then you'd have to use a dataclass-specific function to get access to it. 

There are already at least 2 functions for getting docstrings for objects 
without .__doc__.  They could be enhanced with a dataclass-specific clause.

If ob.__doc__ is None, inspect.getdoc(ob) looks for a docstring elsewhere and 
sometimes succeeds.  For this reason, I just changed IDLE calltips to use 
getdoc for calltips.  If dataclasses.is_dataclass(ob.__class__), then I presume 
getdoc could retrieve the docstring from ob.__class__.__dataclass_fields__.

help(ob) uses pydoc, which gets docstrings with _getowndoc and if needed, 
_finddoc.  Perhaps these should be replaced with inspect.getdoc, but until 
then, _finddoc could have an elif clause added for dataclass fields.

--
nosy: +terry.reedy
stage:  -> test needed

___
Python tracker 

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



[issue42407] Grammatical typo in multiprocessing doc

2020-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset c963da269d3778b65a64ff1bd91f8772c210f305 by Miss Islington (bot) 
in branch '3.9':
bpo-42407: Use possessive appostrophe in multiprocessing doc (GH-23400)
https://github.com/python/cpython/commit/c963da269d3778b65a64ff1bd91f8772c210f305


--

___
Python tracker 

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



[issue42407] Grammatical typo in multiprocessing doc

2020-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset 0762e09eb14269b38f60e1b58d2c7f36056a4694 by Miss Islington (bot) 
in branch '3.8':
bpo-42407: Use possessive appostrophe in multiprocessing doc (GH-23400)
https://github.com/python/cpython/commit/0762e09eb14269b38f60e1b58d2c7f36056a4694


--

___
Python tracker 

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



[issue42407] Grammatical typo in multiprocessing doc

2020-11-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22326
pull_request: https://github.com/python/cpython/pull/23434

___
Python tracker 

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



[issue42407] Grammatical typo in multiprocessing doc

2020-11-20 Thread miss-islington


Change by miss-islington :


--
keywords: +patch
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +22325
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23433

___
Python tracker 

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



[issue42407] Grammatical typo in multiprocessing doc

2020-11-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 6edf06b24a9335a2b0d44634a95e4f5ba0d586d9 by ArioA in branch 
'master':
bpo-42407: Use possessive appostrophe in multiprocessing doc (GH-23400)
https://github.com/python/cpython/commit/6edf06b24a9335a2b0d44634a95e4f5ba0d586d9


--
nosy: +terry.reedy

___
Python tracker 

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



[issue42356] Dict inline manipulations

2020-11-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I agree with Eric suggestion.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue42352] A string representation of slice objects with colon syntax

2020-11-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

What you are or should be asking for is an alternate string representation 
method, perhaps called 'colon', so that for instance
myslice.colon() == '::2'

The function could take an optional length (as with .indices, but optional) to 
produce the same numbers as .indices.

myslice.colon(8) == '0:8:2'
slice(0, -1, 3).colon(14) == '0:13:3'

I suspect that something like this has been asked before.  I suggest you post 
to python-ideas list to see if there is any support and any better idea for the 
name.

--
components: +Interpreter Core
nosy: +terry.reedy
stage:  -> test needed

___
Python tracker 

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



[issue42414] unable to document fields of dataclass

2020-11-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> There is not a way to document fields of a dataclass.

I don't think there is an easy way to do this without a custom descriptor and 
that would add a lot of overhead.

--
nosy: +rhettinger

___
Python tracker 

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



[issue41561] test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch

2020-11-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Christian, I don't see any open PRs to be commit reviewed.

--
nosy: +terry.reedy
versions: +Python 3.10

___
Python tracker 

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



[issue42120] Depreciated MACRO of copysign for MSVC

2020-11-20 Thread Steve Dower


Change by Steve Dower :


--
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



[issue42336] Make PCbuild/build.bat build x64 by default

2020-11-20 Thread Steve Dower


Steve Dower  added the comment:

We also updated the buildbot config to use the new options.

--
assignee:  -> steve.dower
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



[issue42420] queue.Queue().join() add a timeout option

2020-11-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Marking this as a duplicate because it has come up before.

--
nosy: +rhettinger
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> Add timeout parameter to Queue.join()

___
Python tracker 

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



[issue36876] [subinterpreters] Global C variables are a problem

2020-11-20 Thread Eric Snow


Eric Snow  added the comment:


New changeset 9f02b479e6b6b48d0c2aad621978cff82e530b15 by Eric Snow in branch 
'master':
bpo-36876: [c-analyzer tool] Tighten up the results and output. (GH-23431)
https://github.com/python/cpython/commit/9f02b479e6b6b48d0c2aad621978cff82e530b15


--

___
Python tracker 

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



[issue42420] queue.Queue().join() add a timeout option

2020-11-20 Thread Gerhard van Andel


Change by Gerhard van Andel :


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

___
Python tracker 

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



[issue28002] ast.unparse can't roundtrip some f-strings

2020-11-20 Thread Eric V. Smith


Change by Eric V. Smith :


--
resolution: not a bug -> fixed

___
Python tracker 

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



[issue28002] ast.unparse can't roundtrip some f-strings

2020-11-20 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Thanks for your efforts Shantanu!

--

___
Python tracker 

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



[issue28002] ast.unparse can't roundtrip some f-strings

2020-11-20 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
resolution:  -> not a bug
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



[issue36876] [subinterpreters] Global C variables are a problem

2020-11-20 Thread Eric Snow


Change by Eric Snow :


--
pull_requests: +22322
pull_request: https://github.com/python/cpython/pull/23431

___
Python tracker 

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



[issue28002] ast.unparse can't roundtrip some f-strings

2020-11-20 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:


New changeset 3763cc1dbdb930f67b443ceed7c44e4feb883b42 by Miss Islington (bot) 
in branch '3.9':
bpo-28002: Roundtrip f-strings with ast.unparse better (GH-19612) (GH-23430)
https://github.com/python/cpython/commit/3763cc1dbdb930f67b443ceed7c44e4feb883b42


--

___
Python tracker 

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



[issue42360] In the namedtuple documentation, mention that typename should match the variable name for the class to be pickle-able

2020-11-20 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
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



[issue42360] In the namedtuple documentation, mention that typename should match the variable name for the class to be pickle-able

2020-11-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset f552f4b2d635ae031e154374ba3a609c63d09d2b by Miss Islington (bot) 
in branch '3.9':
bpo-42360: Add advice to help avoid pickling issues. (GH-23305) (GH-23429)
https://github.com/python/cpython/commit/f552f4b2d635ae031e154374ba3a609c63d09d2b


--

___
Python tracker 

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



[issue28002] ast.unparse can't roundtrip some f-strings

2020-11-20 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:


New changeset a993e901ebe60c38d46ecb31f771d0b4a206828c by Shantanu in branch 
'master':
bpo-28002: Roundtrip f-strings with ast.unparse better (#19612)
https://github.com/python/cpython/commit/a993e901ebe60c38d46ecb31f771d0b4a206828c


--

___
Python tracker 

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



[issue28002] ast.unparse can't roundtrip some f-strings

2020-11-20 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 9.0 -> 10.0
pull_requests: +22321
pull_request: https://github.com/python/cpython/pull/23430

___
Python tracker 

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



[issue42420] queue.Queue().join() add a timeout option

2020-11-20 Thread Gerhard van Andel


New submission from Gerhard van Andel :

class Queue:

def join():
...

# Can we add a timeout option to the join method on queue.Queue 

def join(timeout=None):
'''Blocks until all items in the Queue have been gotten and processed.

The count of unfinished tasks goes up whenever an item is added to the
queue. The count goes down whenever a consumer thread calls task_done()
to indicate the item was retrieved and all work on it is complete. If
'timeout' is a non-negative number, it blocks at most 'timeout' seconds
and raises the Full exception if no free slot was available within that
time.

When the count of unfinished tasks drops to zero, join() unblocks.
'''
if timeout and timeout < 0:
raise ValueError("'timeout' must be a non-negative number")
with self.all_tasks_done:
while self.unfinished_tasks:
self.all_tasks_done.wait(timeout)

--
components: Library (Lib)
messages: 381506
nosy: vananger93
priority: normal
severity: normal
status: open
title: queue.Queue().join() add a timeout option
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



[issue42360] In the namedtuple documentation, mention that typename should match the variable name for the class to be pickle-able

2020-11-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 9fc319dc033fa32d298fe1c3f171b3d011ac04f0 by Raymond Hettinger in 
branch 'master':
bpo-42360: Add advice to help avoid pickling issues. (GH-23305)
https://github.com/python/cpython/commit/9fc319dc033fa32d298fe1c3f171b3d011ac04f0


--

___
Python tracker 

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



[issue42360] In the namedtuple documentation, mention that typename should match the variable name for the class to be pickle-able

2020-11-20 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +22320
pull_request: https://github.com/python/cpython/pull/23429

___
Python tracker 

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-20 Thread Christian Heimes


Christian Heimes  added the comment:

Even if we would decide to add a memory limit based on cgroups, there is no way 
to implement a limit in Python correctly. We rely on the platforms malloc() 
implementation to handle memory allocation for us.

Python has an abstraction layer for memory allocator, but the allocator only 
tracks Python objects and does not keep information about the size of slabs. 
Memory tracking would increase memory usage and decrease performance. It would 
also not track other memory like 3rd party libraries, extension modules, thread 
stacks, and other processes in the same cgroups hierarchy.

I'm pretty sure that the RLIMIT_AS approach will not work if you run multiple 
processes in the same container (e.g. spawn subprocesses).

I'll talk to our glibc and container experts at work next week. Perhaps they 
are aware of a better way to handle cgroups memory limits more gracefully.

--
components: +Interpreter Core -IO
versions:  -Python 3.6, Python 3.7

___
Python tracker 

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



[issue42414] unable to document fields of dataclass

2020-11-20 Thread Eric V. Smith


Eric V. Smith  added the comment:

@property has a place to attach the docstring, dataclasses in general do not. I 
wouldn't want to add a descriptor just to have the ability to add a docstring. 
There are performance issues involved, and I'm sure some corner cases where 
functionality would change.

Maybe if you bring this up on python-ideas you can get some more ideas.

--

___
Python tracker 

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



[issue40077] Convert static types to heap types: use PyType_FromSpec()

2020-11-20 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +22319
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23428

___
Python tracker 

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-20 Thread Carlos Alexandro Becker


Carlos Alexandro Becker  added the comment:

Just did more tests here:

**on my machine**:

$ docker run --name test -m 1GB fedora:33 python3 -c 'import resource; m = 
int(open("/sys/fs/cgroup/memory/memory.limit_in_bytes").read()); 
resource.setrlimit(resource.RLIMIT_AS, (m, m)); 
print(resource.getrlimit(resource.RLIMIT_AS)); x = bytearray(4 * 1024 * 1024 * 
1000)'; docker inspect test | grep OOMKilled; docker rm test
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
(1073741824, 1073741824)
"OOMKilled": false,
test

$ docker run --name test -m 1GB fedora:33 python3 -c 'x = bytearray(4 * 1024 * 
1024 * 1000)'; docker inspect test | grep OOMKilled; docker rm test
"OOMKilled": true,
test

**on a k8s cluster**:

$ kubectl run -i -t debug --rm --image=fedora:33 --restart=Never 
--limits='memory=1Gi'
If you don't see a command prompt, try pressing enter.
[root@debug /]# python3
Python 3.9.0 (default, Oct  6 2020, 00:00:00)
[GCC 10.2.1 20200826 (Red Hat 10.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x = bytearray(4 * 1024 * 1024 * 1000)
Killed
[root@debug /]# python3
Python 3.9.0 (default, Oct  6 2020, 00:00:00)
[GCC 10.2.1 20200826 (Red Hat 10.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import resource
>>> m = int(open("/sys/fs/cgroup/memory/memory.limit_in_bytes").read())
>>> resource.setrlimit(resource.RLIMIT_AS, (m, m))
>>> print(resource.getrlimit(resource.RLIMIT_AS))
(1073741824, 1073741824)
>>> x = bytearray(4 * 1024 * 1024 * 1000)
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
>>>

--

___
Python tracker 

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



[issue40080] Stripping annotations out as a new optimization mode

2020-11-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Corrected link:  https://bugs.python.org/issue36466

--
superseder:  -> Adding a way to strip annotations from compiled bytecode

___
Python tracker 

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-20 Thread Christian Heimes


Christian Heimes  added the comment:

I doubt it. My test hosts have between 16G and 64G of RAM + plenty of swap.

What's your platform, distribution, Kernel version, Docker version, and 
libseccomp version?

--

___
Python tracker 

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-20 Thread Carlos Alexandro Becker

Carlos Alexandro Becker  added the comment:

FWIW, here, both cases:

```
❯ docker ps -a
CONTAINER IDIMAGE   COMMAND  CREATED
  STATUSPORTS   NAMES
30fc350a8dbdpython:rc-alpine"python -c 'x = byte…"   24 seconds ago 
  Exited (137) 11 seconds ago   great_murdock
5ba46a022910fedora:33   "python3 -c 'x = byt…"   57 seconds ago 
  Exited (137) 43 seconds ago   boring_edison
```

--

___
Python tracker 

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-20 Thread Carlos Alexandro Becker


Carlos Alexandro Becker  added the comment:

Maybe you're trying to allocate more memory than the host has available? I 
found out that it gives MemoryError in those cases too (kind of easy to 
reproduce on docker for mac)...

--

___
Python tracker 

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



[issue42395] aclosing was not added to __all__ in contextlib

2020-11-20 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
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



[issue34463] Discrepancy between traceback.print_exception and sys.__excepthook__

2020-11-20 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-20 Thread Christian Heimes


Christian Heimes  added the comment:

I can neither reproduce the issue with podman and cgroupv2 nor with docker and 
cgroupsv1. In both cases I'm getting a MemoryError as expected:

# podman run -m 1G --cpus 1 python:rc-alpine python -c 'x = bytearray(80 * 1024 
* 1024 * 1000)'
Traceback (most recent call last):
  File "", line 1, in 
MemoryError

# docker run -m 1GB fedora:33 python3 -c 'x = bytearray(80 * 1024 * 1024 * 
1000)'
Traceback (most recent call last):
  File "", line 1, in 
MemoryError

--
nosy: +christian.heimes

___
Python tracker 

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



[issue26290] fileinput and 'for line in sys.stdin' do strange mockery of input buffering

2020-11-20 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

For those who find this in the future, the simplest workaround for the:

for line in sys.stdin:

issue on Python 2 is to replace it with:

for line in iter(sys.stdin.readline, ''):

The problem is caused by the way file.__next__'s buffering behaves, but 
file.readline doesn't use that code (it delegates to either fgets or a loop 
over getc/getc_unlocked that never overbuffers beyond the newline). Two-arg 
iter lets you make an iterator that calls readline each time you want a line, 
and considers a return of '' (which is what readline returns when you hit EOF) 
to terminate iteration.

--
nosy: +josh.r

___
Python tracker 

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-20 Thread Carlos Alexandro Becker


Carlos Alexandro Becker  added the comment:

The problem is that, instead of getting a MemoryError, Python tries to "go out 
of bounds" and allocate more memory than the cgroup allows, causing Linux to 
kill the process.

A workaround is to set RLIMIT_AS to the contents of 
/sys/fs/cgroup/memory/memory.limit_in_bytes, which is more or less what Java 
does when that flag is enabled (there are more things: cgroups v2 has a 
different path I think).

Setting RLIMIT_AS, we get the MemoryError as expected, instead of a SIGKILL.

My proposal is to either make it the default or hide it behind some sort of 
flag/environment variable, so users don't need to do that everywhere...

PS: On java, that flag also causes its OS API to return the limits when asked 
for how much memory is available, instead of returning the host's memory 
(default behavior).

PS: I'm not an avid Python user, just an ops guy, so I mostly write yaml these 
days... please let me know if I said doesn't make sense. 

Thanks!

--

___
Python tracker 

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



[issue42411] respect cgroups limits when trying to allocate memory

2020-11-20 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Could you explain the proposal?

How "+X:UseContainerSupport" behaves for Java? Sorry, I did not use Java for 
ages and don't follow the modern Java best practices.

>From my understanding, without the Docker the allocation of `bytearray(80 * 
>1024 * 1024 * 1000)` leads to `raise MemoryError` if there is no such memory 
>available and malloc()/callloc returns NULL.

The exception is typically not handled at all but unwinded to "kill the 
process" behavior.

The reason for this situation is: in Python when you are trying to handle 
out-of-memory behavior the handler has a very which chance to allocate a Python 
object under the hood and raise MemoryError at any line of the Python exception 
handler.

--
nosy: +asvetlov

___
Python tracker 

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



[issue42418] PyType_GetModule() should warn/fail when type has Py_TPFLAGS_BASETYPE

2020-11-20 Thread hai shi


hai shi  added the comment:

>I propose to either a guard to PyType_GetModule() to prevent misuse of the 
>function or to add a variant of the function that prevents misuse.
+1. Looks like check Py_TPFLAGS_BASETYPE in PyType_GetModule() is an easy way:)

--
nosy: +shihai1991

___
Python tracker 

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



[issue42414] unable to document fields of dataclass

2020-11-20 Thread John-Mark Gurney


John-Mark Gurney  added the comment:

As I said, I expect it to work similar to how property works:
```
>>> class Foo:
...  def getx(self):
...   return 5
...  x = property(getx, doc='document the x property')
... 
>>> help(Foo)
Help on class Foo in module __main__:

class Foo(builtins.object)
 |  Methods defined here:
 |  
 |  getx(self)
 |  
 |  --
 |  Readonly properties defined here:
 |  
 |  x
 |  document the x property
 |  
 |  --
 |  Data descriptors defined here:
 |  
 |  __dict__
 |  dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |  list of weak references to the object (if defined)
```

The pure python implementation of property is at: 
https://docs.python.org/3/howto/descriptor.html#properties

which uses the descriptor protocal as documented in: 
https://docs.python.org/3/howto/descriptor.html

Which uses an object w/ __get__/__set__/__delete__ to emulate attribute access, 
and that object can have the __doc__ property set on it to provide 
documentation.

--

___
Python tracker 

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



[issue40633] json.dumps() should encode float number NaN to null

2020-11-20 Thread Mark Dickinson


Mark Dickinson  added the comment:

@Arjan Staring: could you point to which part of the JSON specification you're 
looking at?

At https://tools.ietf.org/html/rfc7159, the only reference to NaNs that I see 
is:

> Numeric values that cannot be represented in the grammar below (such
> as Infinity and NaN) are not permitted.

At https://www.json.org/json-en.html, there's no mention of IEEE 754 special 
values.

I'm not seeing anything anywhere to suggest that the JSON specification says 
NaNs should be translated to nulls.

--

___
Python tracker 

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



[issue15450] Allow dircmp.subdirs to behave well under subclassing

2020-11-20 Thread Nick Crews


Nick Crews  added the comment:

I re-did this at https://github.com/python/cpython/pull/23424, let me know what 
you think. This is my first PR here, so I may have pooched something.

--

___
Python tracker 

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



[issue15450] Allow dircmp.subdirs to behave well under subclassing

2020-11-20 Thread Nick Crews


Change by Nick Crews :


--
nosy: +NickCrews
nosy_count: 5.0 -> 6.0
pull_requests: +22316
pull_request: https://github.com/python/cpython/pull/23424

___
Python tracker 

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



[issue42345] Equality of typing.Literal depends on the order of arguments

2020-11-20 Thread Guido van Rossum


Change by Guido van Rossum :


--
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



[issue34463] Discrepancy between traceback.print_exception and sys.__excepthook__

2020-11-20 Thread Irit Katriel


Irit Katriel  added the comment:

After debugging the default excepthook code (C version), I see that the 
difference is because the SyntaxError's lineno is None. 

It doesn't mind that the filename is None (it defaults it to ) but when 
it can't get the lineno it gives up here:
https://github.com/python/cpython/blob/fb5db7ec58624cab0797b4050735be865d380823/Python/pythonrun.c#L481

If you run this script:

---
import traceback
import sys

se = SyntaxError("wrong!")
se.filename = "myfile.py"
print("== lineno is None ==")
print('traceback.print_exception:')
traceback.print_exception(type(se), se, None)
print('-')
print('sys.excepthook:')
sys.excepthook(type(se), se, None)
print('-')

se.lineno = 55

print("== lineno is 55 ==")
print('traceback.print_exception:')
traceback.print_exception(type(se), se, None)
print('-')
print('sys.excepthook:')
sys.excepthook(type(se), se, None)
print('-')

---


The output is:
---
Running Release|x64 interpreter...
== lineno is None ==
traceback.print_exception:
  File "myfile.py", line None
SyntaxError: wrong!
-
sys.excepthook:   <-- file-lineno missing
SyntaxError: wrong! (myfile.py)
-
== lineno is 55 ==
traceback.print_exception:
  File "myfile.py", line 55
SyntaxError: wrong!
-
sys.excepthook:
  File "myfile.py", line 55   <-- file-lineno is there
SyntaxError: wrong!
-
---

--

___
Python tracker 

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



[issue42405] Add distutils mvsccompiler support for Windows ARM64 build

2020-11-20 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

If you wish for the functionality to be available in setuptools (backported), 
please contribute the change at https://github.com/pypa/distutils. At some 
point, contributions to CPython will also be synced there as well, and any 
changes there get synced into Setuptools. Unfortunately, at this stage, that 
functionality is only exposed through a feature flag when 
`SETUPTOOLS_USE_DISTUTILS=local` is set... until downstream implementations in 
Linux distributions and monkeypatches such as with Numpy can be updated not to 
rely on the implementation details as found in the stdlib.

--

___
Python tracker 

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



[issue42414] unable to document fields of dataclass

2020-11-20 Thread Eric V. Smith


Eric V. Smith  added the comment:

How would you expect to extract this docstring?

I'm not sure how this would work in practice, since both of these are errors:

>>> class A:
...def __init__(self):
...self.x = 3
...self.x.__doc__ = 'foo'
...
>>> A()
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 4, in __init__
AttributeError: 'int' object attribute '__doc__' is read-only
>>> class B:
...x: int = 0
...x.__doc__ = 'foo'
...
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 3, in B
AttributeError: 'int' object attribute '__doc__' is read-only

It could be stored in the dataclass-specific data attached to a class, but then 
you'd have to use a dataclass-specific function to get access to it. I'm not 
sure that's a great improvement.

I also note that attrs doesn't have this feature, probably for the same reason.

--
type:  -> enhancement
versions: +Python 3.10

___
Python tracker 

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



[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2020-11-20 Thread Paul Ganssle


Change by Paul Ganssle :


--
dependencies:  -pathlib.PurePath.parents rejects negative indexes
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



[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2020-11-20 Thread Paul Ganssle


Paul Ganssle  added the comment:


New changeset 452058448335b39c784af9a047f9c4a1767c0b00 by Joshua Cannon in 
branch 'master':
bpo-35498: Added slice support to PathLib parents attribute. (GH-11165)
https://github.com/python/cpython/commit/452058448335b39c784af9a047f9c4a1767c0b00


--

___
Python tracker 

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



[issue26067] test_shutil fails when gid name is missing

2020-11-20 Thread Irit Katriel


Change by Irit Katriel :


--
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



[issue35847] RISC-V needs CTYPES_PASS_BY_REF_HACK

2020-11-20 Thread Irit Katriel


Change by Irit Katriel :


--
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



[issue36520] Email header folded incorrectly

2020-11-20 Thread Irit Katriel


Change by Irit Katriel :


--
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



[issue20582] socket.getnameinfo() does not document flags

2020-11-20 Thread Irit Katriel


Change by Irit Katriel :


--
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



[issue32082] atexit module: allow getting/setting list of handlers directly

2020-11-20 Thread Xtrem532


Change by Xtrem532 :


--
nosy: +Xtrem532

___
Python tracker 

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



[issue42212] Check if generated files are up-to-date in Github Actions

2020-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

While we are here... it might interesting to also run patchcheck.py on PRs 
using GitHub Actions:
https://mail.python.org/archives/list/python-...@python.org/message/DKLD2VLHZ3F54WTKZ7JHKWBMOZ4N5TK7/

.travis.yml uses:

script:
  # Using the built Python as patchcheck.py is built around the idea of using
  # a checkout-build of CPython to know things like what base branch the changes
  # should be compared against.
  # Only run on Linux as the check only needs to be run once.
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./python 
Tools/scripts/patchcheck.py --travis $TRAVIS_PULL_REQUEST; fi

--

___
Python tracker 

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



[issue42212] Check if generated files are up-to-date in Github Actions

2020-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

Let's see how it goes on PRs for a few days, and later we can decide if it 
should be backported to 3.8 and 3.9 branches.

--

___
Python tracker 

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



[issue42212] Check if generated files are up-to-date in Github Actions

2020-11-20 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset d20b7ed9c1fabac3fdebb7ec362fe4f022a54639 by Filipe Laíns in 
branch 'master':
bpo-42212: Check if generated files are up-to-date in GitHub Actions (GH-23042)
https://github.com/python/cpython/commit/d20b7ed9c1fabac3fdebb7ec362fe4f022a54639


--

___
Python tracker 

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



[issue42212] Check if generated files are up-to-date in Github Actions

2020-11-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22315
pull_request: https://github.com/python/cpython/pull/23423

___
Python tracker 

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



[issue40633] json.dumps() should encode float number NaN to null

2020-11-20 Thread Arjan Staring


Arjan Staring  added the comment:

Please re-evaluate; the current behaviour is incompatible with JSON 
specification in favour of providing the user/application/consumer of the 
resulted JSON information regarding the conversion process. Given what is 
stated in the documentation I do agree with the default behaviour, but I don't 
agree with only supporting "most JavaScript based encoders and decoders" and 
not supporting the JSON specification. I would opt to support "most encoders 
and decoders" + the JSON specification. Furthermore, the allow_nan doesn't 
allow anything, it forces as no alternative is provided. Setting it to false 
does not make it disallow, but makes it not work at all, forcing to use the 
default behaviour. I would suggest when allow_nan is set to false, to make it 
compliant with JSON and use null instead (as per specification). This way we 
are supporting most Javascript based encoders and decoders, but can also 
produce JSON compliant output.

--
nosy: +arjanstaring

___
Python tracker 

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



[issue42403] Cleanup importlib code

2020-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

I tried to rework how importlib/_bootstrap.py is imported and rework 
importlib/__init__.py code which imports _bootstrap.py and 
_bootstrap_external.py, but I introduced bugs. I prefer to leave the code as it 
is.

At least, _bootstrap_external.py is now able to use regular imports (for 
builtin modules) rather than requiring to inject modules afterwards.

--
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



[issue42403] Cleanup importlib code

2020-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3be8e220ede7764a403b74eb2051aa703dde2626 by Victor Stinner in 
branch 'master':
bpo-42403: Use @staticmethod in importlib (GH-23395)
https://github.com/python/cpython/commit/3be8e220ede7764a403b74eb2051aa703dde2626


--

___
Python tracker 

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



[issue42419] Typo in "what's new in Python 3.9"

2020-11-20 Thread Quentin Hibon


Change by Quentin Hibon :


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

___
Python tracker 

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



[issue42419] Typo in "what's new in Python 3.9"

2020-11-20 Thread Quentin Hibon


New submission from Quentin Hibon :

"deprecatations" should be "deprecations"

--
assignee: docs@python
components: Documentation
messages: 381478
nosy: docs@python, hiqua
priority: normal
severity: normal
status: open
title: Typo in "what's new in Python 3.9"
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



[issue42392] remove the 'loop' parameter from __init__ in all classes in asyncio.locks

2020-11-20 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


--
keywords: +patch
nosy: +uriyyo
nosy_count: 3.0 -> 4.0
pull_requests: +22313
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23420

___
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-11-20 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset a6109ef68d421712ba368ef502c4789e8de113e0 by Erlend Egeberg 
Aasland in branch 'master':
bpo-1635741: Convert _sre types to heap types and establish module state (PEP 
384) (GH-23393)
https://github.com/python/cpython/commit/a6109ef68d421712ba368ef502c4789e8de113e0


--

___
Python tracker 

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



[issue4999] multiprocessing.Queue does not order objects

2020-11-20 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> out of date
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



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

2020-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 2db8e35489d63b976a463fb1d2a6c29f4f965c21 by Mohamed Koubaa in 
branch 'master':
bpo-1635741: Enhance _datetime error handling (GH-23139)
https://github.com/python/cpython/commit/2db8e35489d63b976a463fb1d2a6c29f4f965c21


--

___
Python tracker 

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



[issue42418] PyType_GetModule() should warn/fail when type has Py_TPFLAGS_BASETYPE

2020-11-20 Thread Christian Heimes


New submission from Christian Heimes :

PyType_GetModule() may return wrong or unexpected result when a type has 
the feature flag Py_TPFLAGS_BASETYPE. The base type flag permits subclassing of 
an extension class. The function will return NULL when a type is subclasses in 
Python space or a different module object when the type is subclasses and 
initialized in a differen C extension module.

All subclassable types must use _PyType_GetModuleByDef() to safely access  
module and module state struct. It's easy to miss the problem. I missed it when 
I ported some of my code to heap types and multiphase init.

I propose to either a guard to PyType_GetModule() to prevent misuse of the 
function or to add a variant of the function that prevents misuse.

--
components: Interpreter Core
messages: 381475
nosy: christian.heimes, corona10, petr.viktorin, vstinner
priority: normal
severity: normal
stage: needs patch
status: open
title: PyType_GetModule() should warn/fail when type has Py_TPFLAGS_BASETYPE
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue42417] Empty body {} in POST requests leads to 405 Method not allowed error

2020-11-20 Thread Bhushan Shelke


Bhushan Shelke  added the comment:

I have looked at requests lib code. As far as I could understand following is 
the flow of packages used in this case -

request "uses->" urllib3 "uses->" http

--

___
Python tracker 

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



[issue42417] Empty body {} in POST requests leads to 405 Method not allowed error

2020-11-20 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Please check with the requests project as well, I'm not sure how much of the 
stdlib HTTP client is used by requests.

This issue can stay open because the issue is reproducible using the stdlib.

--

___
Python tracker 

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



[issue42417] Empty body {} in POST requests leads to 405 Method not allowed error

2020-11-20 Thread Bhushan Shelke


Bhushan Shelke  added the comment:

Yes Ronald I am using requests library however I tried HTTPSConnection class 
from http.client package as well getting same error, may be because cause is in 
the core http library itself

--

___
Python tracker 

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



[issue42417] Empty body {} in POST requests leads to 405 Method not allowed error

2020-11-20 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Are you using the requests library (https://requests.readthedocs.io/en/master/)?

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue42417] Empty body {} in POST requests leads to 405 Method not allowed error

2020-11-20 Thread Bhushan Shelke


Change by Bhushan Shelke :


--
components: +Library (Lib)

___
Python tracker 

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



[issue42417] Empty body {} in POST requests leads to 405 Method not allowed error

2020-11-20 Thread Bhushan Shelke


New submission from Bhushan Shelke :

I have a Tomcat+Java based server exposing REST APIs. I am writing a client in 
python to consume those APIs. Everything is fine until I send empty body in 
POST request. It is a valid use case for us. If I send empty body I get 400 bad 
request error - Invalid character found in method name [{}POST]. HTTP method 
names must be tokens. If I send empty request from POSTMAN or Java or CURL it 
works fine, problem is only when I used python as a client. 

If I use python based server (attached a simple server program for same) then I 
get 405 Method not allowed instead of 400 that I get using java based server.

Server code is Following is python snippet -

json_object={}
header = {'alias': 'A', 'Content-Type' : 'application/json', 'Content-Length' : 
'0'} 
resp = requests.post(url, auth=(username, password), headers=header, 
json=json_object) 
I tried using data as well instead of json param to send payload with not much 
of success.

I captured the wireshark dumps to undertand it further and found that, the 
request tomcat received is not as per RFC2616 
(https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html). Especially the part - 
Request-Line = Method SP Request-URI SP HTTP-Version CRLF Because I could see 
in from wireshark dumps it looked like - {}POST MY-APP-URI HTTP/1.1

As we can see the empty body is getting prefixed with http-method, hence tomcat 
reports that as an error. I then looked at python http library code -client.py. 
Following are relevant details -

File - client.py

Method - _send_output (starting at line # 1001) - It first sends the header at 
line #1010 and then the body somewhere down in the code. I thought(I could be 
wrong here) perhaps in this case header is way longer 310 bytes than body 2 
bytes, so by the time complete header is sent on wire body is pushed and hence 
TCP frames are order in such a way that body appears first. To corroborate this 
I added a delay of 1 second just after sending header line#1011 and bingo, the 
error disappeared and it started working fine. Not sure if this is completely 
correct analysis, but can someone in the know can confirm or let me know how to 
fix this.

--
components: Windows
files: sample_flask.py
messages: 381470
nosy: bhushan.shelke, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Empty body {} in POST requests leads to 405 Method not allowed error
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file49609/sample_flask.py

___
Python tracker 

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



[issue42345] Equality of typing.Literal depends on the order of arguments

2020-11-20 Thread Yurii Karabas


Yurii Karabas <1998uri...@gmail.com> added the comment:

Looks like everything merged, we can close this issue

--

___
Python tracker 

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



[issue42405] Add distutils mvsccompiler support for Windows ARM64 build

2020-11-20 Thread Adrian Vladu


Adrian Vladu  added the comment:

Thank you for the suggestion, I will update the PR accordingly to change the 
__msvccompiler.py. I just need to find a good candidate that uses that 
implementation to check if the compilation gets fixed.

--

___
Python tracker 

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



[issue42333] Port ssl module to heap types and module state (PEP 573)

2020-11-20 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 5c36da78d738d0e5fdb539a758cc15abc47c843b by Christian Heimes in 
branch 'master':
bpo-42333: Port _ssl extension module to heap types (GH-23392)
https://github.com/python/cpython/commit/5c36da78d738d0e5fdb539a758cc15abc47c843b


--

___
Python tracker 

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



[issue42413] Replace custom exception socket.timeout with TimeoutError

2020-11-20 Thread Christian Heimes


Change by Christian Heimes :


--
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



[issue42413] Replace custom exception socket.timeout with TimeoutError

2020-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset 03c8ddd9e94c7bddf1f06cf785027b8d2bf00ff0 by Christian Heimes in 
branch 'master':
bpo-42413: socket.timeout is now an alias of TimeoutError (GH-23413)
https://github.com/python/cpython/commit/03c8ddd9e94c7bddf1f06cf785027b8d2bf00ff0


--
nosy: +miss-islington

___
Python tracker 

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