[issue46373] TypedDict and NamedTuple do not evaluate cross-module ForwardRef in all cases

2022-01-14 Thread Andreas H.


New submission from Andreas H. :

TypedDict does not resolve cross-module ForwardRefs when the ForwardRef is not 
a direct one. 

In other words the fix GH-27017 (issue 41249) for TypedDict seems incomplete.

The same issue seem to exist for NamedTuple.



Example:

   #module.py
   TD = typing.TypedDict("TD", {'test': typing.List[typing.Optional['Y']]})
   class Y:
  pass


   # other module
   class TDSub(module.TD):
   a: int
   get_type_hints(TDSub)
   # -> Exception   NameError: Y not found


On the other hand, with direct ForwardRef, as e.g. in 
   TD = typing.TypedDict("TD", {'test':  'Y' } )

it works (that was indeed fixed by GH-27017)



Same issue exists for NamedTuple. There neither of the above works, i.e. 
cross-module ForwardRefs are never resolve (but they could - als NamedTuple has 
the __module__ member set with to calling module). I am not sure if inheritance 
for NamedTuple is supported so I do not know if it is really a bug. 


The problem in the code is that in TypedDict the `module` parameter is passed 
only onto the immediate ForwardRef. One option could be to recursively walk the 
type and search for unpatched ForwardRefs and set the module parameter.
On the other hand, the retroactive patching of forward refs is problematic as 
it may mess with the caching mechanism im typing.py. There may be a type with 
ForwardRef already in cache (and used by more than one user), but only for one 
user the `module` is to be updated. So probably a correct implementation is 
tricky, or some other way has to be found to update the `module` of ForwardRefs 
(e.g. by copying the type tree).


For NamedTuple the whole mechanism of passing the `module` parameter to the 
ForwardRefs is not done (not even for direct ForwardRef ones).


Not sure how important this (likely not very) is as I do not use TypedDict and 
NamedTuple. This is just to report it.

--
components: Library (Lib)
messages: 410547
nosy: AlexWaygood, Jelle Zijlstra, andreash, gvanrossum, kj, kumaraditya303, 
sobolevn
priority: normal
severity: normal
status: open
title: TypedDict and NamedTuple do not evaluate cross-module ForwardRef in all 
cases
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue46362] os.path.abspath() needs more normalization on Windows

2022-01-14 Thread neonene


Change by neonene :


--
pull_requests: +28793
pull_request: https://github.com/python/cpython/pull/30595

___
Python tracker 

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



[issue46369] get_type_hints does not evaluate ForwardRefs inside NewType

2022-01-14 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

I think we should go with `1)` and `A`.
Adding a special case for getting hints from `NewType` directly does seem 
inconsistent with other type-constructs.

Do you want to fix this? :)
Or I can work on it today if you wish!

--

___
Python tracker 

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



[issue46369] get_type_hints does not evaluate ForwardRefs inside NewType

2022-01-14 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Oh, I mean `1)` and `B`

--

___
Python tracker 

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



[issue46374] Assertion failed in ceval.c

2022-01-14 Thread Kumar Aditya


Change by Kumar Aditya :


--
components: Interpreter Core
nosy: kumaraditya303
priority: normal
severity: normal
status: open
title: Assertion failed in ceval.c
type: crash

___
Python tracker 

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



[issue46374] Assertion failed in ceval.c

2022-01-14 Thread Kumar Aditya


Change by Kumar Aditya :


--
versions: +Python 3.11

___
Python tracker 

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



[issue46374] Assertion failed in ceval.c

2022-01-14 Thread Kumar Aditya

New submission from Kumar Aditya :

The following code causes Assertion failed on Windows 11 


import cProfile
def test():
import sys
import dis

with cProfile.Profile() as p:
test()

Error:

❯ ./python.bat main.py 
Running Debug|x64 interpreter...
Assertion failed: frame->f_lasti >= 0, file D:\cpython\Python\ceval.c, line 6509

--

___
Python tracker 

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



[issue46364] asyncio subprocess cannot read from /dev/stdin

2022-01-14 Thread xoph


Change by xoph :


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

___
Python tracker 

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



[issue46374] Assertion failed in ceval.c

2022-01-14 Thread Kumar Aditya


Kumar Aditya  added the comment:

Tested commit is 7c770d3350813a82a639fcb3babae0de2b87aaae

--

___
Python tracker 

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



[issue46374] Assertion failed in ceval.c

2022-01-14 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-14 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +28795
pull_request: https://github.com/python/cpython/pull/30597

___
Python tracker 

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



[issue46375] io.BytesIO does not have peek()

2022-01-14 Thread Marcel Martin


New submission from Marcel Martin :

It would be great to be able to use peek() on BytesIO objects.

I have a function that gets passed a file-like object and uses peek() on it. 
This works for nearly all types of files relevant in my library, except BytesIO 
instances (which I use during testing), for which I need to add a small 
workaround using tell() and seek().

--
components: Library (Lib)
messages: 410552
nosy: marcelm
priority: normal
severity: normal
status: open
title: io.BytesIO does not have peek()
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue31116] base85 z85 variant encoding

2022-01-14 Thread Matan Perelman


Change by Matan Perelman :


--
keywords: +patch
nosy: +matan1008
nosy_count: 3.0 -> 4.0
pull_requests: +28796
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30598

___
Python tracker 

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



[issue46375] io.BytesIO does not have peek()

2022-01-14 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +benjamin.peterson, kumaraditya303, stutzbach

___
Python tracker 

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



[issue46374] Assertion failed in ceval.c

2022-01-14 Thread Mark Shannon


Mark Shannon  added the comment:

I can reproduce this on linux.

The problem is that when closing a generator that has not started, the frame 
may not be in a valid state (hence the assertion failure).

This should be fixed by implementing 
https://github.com/faster-cpython/ideas/discussions/217 as that will ensure 
that the frame is in a valid state before the generator is created.

I'll make implementing https://github.com/faster-cpython/ideas/discussions/217 
a priority in order to fix this.

--
assignee:  -> Mark.Shannon
nosy: +brandtbucher

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-14 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset c8319f7921fbcb0dea04da48a1b04a5d0d21ae1c by Christian Heimes in 
branch 'main':
bpo-40280: Build WASM stdlib bundle and more modules for node (GH-30597)
https://github.com/python/cpython/commit/c8319f7921fbcb0dea04da48a1b04a5d0d21ae1c


--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Aviram


New submission from Aviram :

This is re-open of https://bugs.python.org/issue5945.
In the former issue, it was decided that documenting the odd behavior and later 
providing clean, good ABC C API would be the long term solution.
Few years passed and there are no alternatives AFAIK
I am wondering if that's due to lack of resources or just forgotten?
I don't mind contributing the necessary change in case there's really nothing 
in progress and it is something Python community wants to fix.
Hopefully there's an existing solution and I just didn't search well enough.

--
components: C API
messages: 410555
nosy: aviramha
priority: normal
severity: normal
status: open
title: PyMapping_Check returns 1 for list
type: behavior
versions: Python 3.10, Python 3.11, 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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Aviram


Change by Aviram :


--
nosy: +benjamin.peterson, bukzor, georg.brandl, jmillikin, levkivskyi, 
miss-islington, pitrou, rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue45991] Improve ambiguous docstrings in pkgutil

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
versions:  -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue46269] '__new__' is never shown in `dir(SomeEnum)`

2022-01-14 Thread Nikita Sobolev


Change by Nikita Sobolev :


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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-14 Thread Nikita Sobolev


Change by Nikita Sobolev :


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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Aviram


Aviram  added the comment:

https://github.com/PyO3/pyo3/issues/2072 Relevant discussion in PyO3 related 
issue

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Ashley Anderson


Change by Ashley Anderson :


--
nosy: +aganders3

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Aviram


Aviram  added the comment:

Would checking the TPFLAGS for `Py_TPFLAGS_SEQUENCE` & `Py_TPFLAGS_MAPPING` 
when using `PySequence_Check` & `PyMapping_Check` be a valid fix?

--

___
Python tracker 

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



[issue46377] TimedRotatingFileHandler "midnight" misleading when interval > 1

2022-01-14 Thread Mike Schiessl


New submission from Mike Schiessl :

Using the TimedRotatingFileHandler along with "when='midnight'" and interval > 
1, midnight is handled equally to "days" which is a little misleading.

Expectation:
setting when to 'midnight', the file is rotated every midnight (interval value 
should be ignored)

Current behavior:
If 'midnight' is given alongside with an interval greater than 1 (.e.g 5), the 
(internal) interval (24*60*60) is calculated with the given interval -> 
24*60*60 * 5.


In my case, this led to some unforeseeable and unexpected behavior.

--
components: Library (Lib)
messages: 410558
nosy: mschiess, vinay.sajip
priority: normal
severity: normal
status: open
title: TimedRotatingFileHandler "midnight" misleading when interval > 1
type: behavior
versions: Python 3.10, Python 3.11, 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



[issue46377] TimedRotatingFileHandler "midnight" misleading when interval > 1

2022-01-14 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 2.0 -> 3.0
pull_requests: +28797
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30599

___
Python tracker 

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



[issue45492] stdlib inspect documentation on code.co_names is incorrect

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
versions:  -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue32876] HTMLParser raises exception on some inputs

2022-01-14 Thread Irit Katriel


Irit Katriel  added the comment:

The error() method was removed in issue31844.

--
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed
superseder:  -> HTMLParser: undocumented not implemented method

___
Python tracker 

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



[issue44594] AsyncExitStack.enter_async_context() is mishandling exception __context__

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue38656] [doc] clarify what data the mimetypes.MimeTypes class uses

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
keywords:  -patch
title: mimetypes for python 3.7.5 fails to detect matroska video -> [doc] 
clarify what data the mimetypes.MimeTypes class uses
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.7

___
Python tracker 

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



[issue44577] Probably defect in Python 3.7.11

2022-01-14 Thread Irit Katriel


Irit Katriel  added the comment:

Python 3,7 is no longer maintained. Please create a new issue if you see this 
on a current version (>= 3.9) and are able to provide more information.

--
nosy: +iritkatriel
resolution:  -> rejected
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



[issue32876] HTMLParser raises exception on some inputs

2022-01-14 Thread Hanno Boeck


Hanno Boeck  added the comment:

Now the example code raises an AssertionError(). Is that intended? I don't 
think that's any better.

I usually wouldn't expect an HTML parser to raise any error if you pass it a 
string, but instead to do fault tolerant parsing. And if it's expected that 
some inputs can generate exceptions, at least I think this should be properly 
documented.

--

___
Python tracker 

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



[issue42609] Eval with too high string multiplication crashes newer Python versions

2022-01-14 Thread Irit Katriel


Irit Katriel  added the comment:

Apart from the 3.9 backport this is complete.

--
nosy: +iritkatriel, lukasz.langa
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue46331] 3.11: tracing revisits class line after class docstring

2022-01-14 Thread Mark Shannon


Change by Mark Shannon :


--
assignee:  -> Mark.Shannon
keywords: +patch
stage:  -> patch review

___
Python tracker 

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



[issue32876] HTMLParser raises exception on some inputs

2022-01-14 Thread Irit Katriel


Irit Katriel  added the comment:

Reopening to discuss what the correct behaviour should be.

--
resolution: out of date -> 
status: closed -> open
versions: +Python 3.11 -Python 2.7, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue39316] settrace skips lines when chaining methods without arguments

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Bar Harel


Bar Harel  added the comment:

Up until now, trying to distinguish between actual sequences and mappings in 
C-API was a pain. Same methods are implemented in customer user classes, and 
the ABCs could have either been registered dynamically or had an appropriate 
__subclasshook__. On top of that, making the same checks as isinstance 
regarding the whole ABC and __mro__ chain would considerably slow down the code.

The new tp_flags are set in both registered abc classes, and subclasses of the 
appropriate types. As tp_flags exists, we don't even need to account for 
tp_as_mapping and tp_as_sequence. According to the docs "if such a flag bit is 
clear, the type fields it guards must not be accessed and must be considered to 
have a zero or NULL value instead.". User made classes that don't inherit from 
the Sequence and Mapping ABCs are not considered either, and there is no 
__subclasshook__ for these ABCs so inheritance is fully enforced.

As we cover builtins, c-extension classes and user-made Python classes, 
checking tp_flags is guaranteed to be accurate for distinguishing between 
mapping and sequence types, and would be as fast as a pointer dereference can 
be.

Modifying the current PySequence_Check and PyMapping_Check might be a breaking 
change, especially on a C-API level. However one can argue that checking for a 
mapping and expecting a failure on user-made mappings counts as a bug. Having 
them accurately return the correct type in a fast manner using tp_flags is 
therefore an acceptable breaking change.

--
nosy: +bar.harel

___
Python tracker 

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



[issue46377] TimedRotatingFileHandler "midnight" misleading when interval > 1

2022-01-14 Thread Vinay Sajip


Vinay Sajip  added the comment:

Making a change without considering backward compatibility is premature. I've 
closed the PR as there appears to be something wrong with it - it references 
hundreds of changed files. Did you look at the 'atTime' keyword parameter of 
TimedRotatingFileHandler?

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Bar Harel


Bar Harel  added the comment:

Do note, the relevant functions are in the Stable ABI, and their promise will 
slightly change, yet modifying the current functions instead of creating new 
ones may still be beneficial.

--

___
Python tracker 

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



[issue46377] TimedRotatingFileHandler "midnight" misleading when interval > 1

2022-01-14 Thread Mike Schiessl


Mike Schiessl  added the comment:

i've just checked PR and you're right, something with the PR went wrong.

Anyway, midnight (at least from the wording) specifies the "atTime". (which 
should be midnight). 


Again, if there's (by mistake) an interval bigger than 1 set(which in my mind 
makes no sense along to be used with midnight) things are getting pretty 
intransparent. The midnight handler created a logfile dated with 2021-12-15 
(last night). Took me some time to get this sorted. (I've discovered, that I've 
set 30 in a default value file).

Agreed on the backward compatibility, but I would assume someone using 
"midnight" would not expect any other behavior than "daily at midnight" besides 
using the atTime to modify the rollover time. (my opinion)

--

___
Python tracker 

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



[issue46362] os.path.abspath() needs more normalization on Windows

2022-01-14 Thread Steve Dower


Steve Dower  added the comment:


New changeset 71c0b859ae16ee748cbb050a1f4de93c04e04f83 by neonene in branch 
'main':
bpo-46362: Ensure abspath() tests pass through environment variables to 
subprocess (GH-30595)
https://github.com/python/cpython/commit/71c0b859ae16ee748cbb050a1f4de93c04e04f83


--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Aviram


Change by Aviram :


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

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue46369] get_type_hints does not evaluate ForwardRefs inside NewType

2022-01-14 Thread Andreas H.


Andreas H.  added the comment:

Allright. B) sounds good to me. I dont think I have time today, so please feel 
to tackle the issue. If not I can look at it the next week.

--

___
Python tracker 

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



[issue46378] Experiment with LLVM BOLT binary optimizer

2022-01-14 Thread Dong-hee Na


New submission from Dong-hee Na :

Just experiment how it will be worth :)

Thread: https://github.com/faster-cpython/ideas/issues/224

--
assignee: corona10
messages: 410570
nosy: corona10
priority: normal
severity: normal
status: open
title: Experiment with LLVM BOLT binary optimizer
type: performance
versions: Python 3.11

___
Python tracker 

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



[issue46377] TimedRotatingFileHandler "midnight" misleading when interval > 1

2022-01-14 Thread Vinay Sajip


Vinay Sajip  added the comment:

Unfortunately, you can't rely on people always doing "the sensible thing", for 
any number of good reasons. If a particular set of parameter values didn't 
cause failure, it is probably used somewhere.

Anyway, your problem goes away if interval == 1, right? If we were to tighten 
things up (e.g. disallowing interval > 1 with "midnight"), then it would have 
to be done on a deprecation cycle at the very least, ISTM.

--

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-14 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +28800
pull_request: https://github.com/python/cpython/pull/30601

___
Python tracker 

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



[issue32696] Fix pickling exceptions with multiple arguments

2022-01-14 Thread Zefir-13000


Change by Zefir-13000 :


--
nosy: +Zefir-13000
nosy_count: 11.0 -> 12.0
pull_requests: +28801
pull_request: https://github.com/python/cpython/pull/30602

___
Python tracker 

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



[issue46287] UNC path normalisation issues on Windows

2022-01-14 Thread Eryk Sun


Change by Eryk Sun :


--
Removed message: https://bugs.python.org/msg410068

___
Python tracker 

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



[issue23183] timeit CLI best of 3: undocumented output format

2022-01-14 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 73140de97cbeb01bb6c9af1da89ecb9355921e91 by Hugo van Kemenade in 
branch 'main':
bpo-23183: Document the timeit output (GH-30359)
https://github.com/python/cpython/commit/73140de97cbeb01bb6c9af1da89ecb9355921e91


--

___
Python tracker 

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



[issue23183] timeit CLI best of 3: undocumented output format

2022-01-14 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +28802
pull_request: https://github.com/python/cpython/pull/30603

___
Python tracker 

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



[issue23183] timeit CLI best of 3: undocumented output format

2022-01-14 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28803
pull_request: https://github.com/python/cpython/pull/30604

___
Python tracker 

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



[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Markus Wallerberger


New submission from Markus Wallerberger :

The reference implementation of itertools.product creates large temporaries, 
which we need to remind people of at the top of the code block.

However, using generator magic, we don't need to do this and can even simplify 
the code in the process!  Basically,we iterate over a generator of 
product(*seq[:-1]), and extend each of the values by every value in seq[-1].

--
assignee: docs@python
components: Documentation
messages: 410573
nosy: docs@python, mwallerb
priority: normal
severity: normal
status: open
title: itertools.product reference implementation creates temporaries
type: enhancement
versions: Python 3.10, Python 3.11, 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



[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Markus Wallerberger


Change by Markus Wallerberger :


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

___
Python tracker 

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



[issue33178] Add support for BigEndianUnion and LittleEndianUnion in ctypes

2022-01-14 Thread David Goncalves


David Goncalves  added the comment:

Any core developers available to review this PR?

--

___
Python tracker 

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



[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Alex Waygood


Alex Waygood  added the comment:

(I'm removing 3.6 and 3.7 from the "versions" field, since those two branches 
are now only accepting patches if it relates to security.)

--
nosy: +AlexWaygood, rhettinger
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue23183] timeit CLI best of 3: undocumented output format

2022-01-14 Thread miss-islington


miss-islington  added the comment:


New changeset 26039d1e0a1da897d28688895126eb8bbd16f2c9 by Miss Islington (bot) 
in branch '3.10':
bpo-23183: Document the timeit output (GH-30359)
https://github.com/python/cpython/commit/26039d1e0a1da897d28688895126eb8bbd16f2c9


--

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-14 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset ee1a8b336d30476e9635a6826f61a99fc3604159 by Christian Heimes in 
branch 'main':
bpo-40280: Block more syscalls that are causing crashes in tests (GH-30601)
https://github.com/python/cpython/commit/ee1a8b336d30476e9635a6826f61a99fc3604159


--

___
Python tracker 

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



[issue23183] timeit CLI best of 3: undocumented output format

2022-01-14 Thread miss-islington


miss-islington  added the comment:


New changeset 9badf6895a9bc1b01b2d6b2fb35419e7c5523ce6 by Miss Islington (bot) 
in branch '3.9':
bpo-23183: Document the timeit output (GH-30359)
https://github.com/python/cpython/commit/9badf6895a9bc1b01b2d6b2fb35419e7c5523ce6


--

___
Python tracker 

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



[issue23183] timeit CLI best of 3: undocumented output format

2022-01-14 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



[issue46380] `test_functools.TestLRU` must not use `functools` module directly

2022-01-14 Thread Nikita Sobolev


New submission from Nikita Sobolev :

Right now there are two tests in Lib/test/test_functools.py that use 
`functools.lru_cache` directly:
1. 
https://github.com/python/cpython/blame/73140de97cbeb01bb6c9af1da89ecb9355921e91/Lib/test/test_functools.py#L1417
2. 
https://github.com/python/cpython/blame/73140de97cbeb01bb6c9af1da89ecb9355921e91/Lib/test/test_functools.py#L1429

But, I don't think it is correct. Why?

```python
class TestLRUPy(TestLRU, unittest.TestCase):
module = py_functools

class TestLRUC(TestLRU, unittest.TestCase):
module = c_functools
```

Source: 
https://github.com/python/cpython/blame/73140de97cbeb01bb6c9af1da89ecb9355921e91/Lib/test/test_functools.py#L1798-L1823

So, what can we do?

1. Use `self.module.lru_cache` instead (I think it is the right way)
2. Move them to `TestLRUPy`, but I don't think they should be python-specific

--
components: Tests
messages: 410579
nosy: sobolevn
priority: normal
severity: normal
status: open
title: `test_functools.TestLRU`  must not use `functools` module directly
type: behavior
versions: Python 3.11

___
Python tracker 

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



[issue46380] `test_functools.TestLRU` must not use `functools` module directly

2022-01-14 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue31472] "Emulating callable objects" documentation misleading

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> works for me
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



[issue46053] NetBSD: ossaudio support incomplete

2022-01-14 Thread Thomas Klausner


Thomas Klausner  added the comment:

ping - this patch needs a review

--

___
Python tracker 

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



[issue46045] NetBSD: do not use POSIX semaphores

2022-01-14 Thread Thomas Klausner


Thomas Klausner  added the comment:

ping - this patch needs a review

--

___
Python tracker 

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



[issue46377] TimedRotatingFileHandler "midnight" misleading when interval > 1

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
type: behavior -> enhancement
versions:  -Python 3.10, 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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
type: behavior -> enhancement
versions:  -Python 3.10, 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



[issue46363] Two typos in versions 3.7 document translation of zh_CN

2022-01-14 Thread Irit Katriel


Irit Katriel  added the comment:

I copied the issue there: https://github.com/python/python-docs-zh-cn/issues/238

--
resolution:  -> third party
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



[issue46377] TimedRotatingFileHandler "midnight" misleading when interval > 1

2022-01-14 Thread Mike Schiessl


Mike Schiessl  added the comment:

Yes, enforcing interval == 1 or interval == None (which pulls the 
TimedRotatingFileHandler class __init__ default value which is also 1) works 
perfectly with midnight.

I do not see any urge on that topic - as I personally now know the issue :D - 
but I really feel this fix could save someones else's time someday ;) 

So going the "safe" way via deprecation cycle seems to be the right approach

--

___
Python tracker 

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



[issue41403] Uncaught AttributeError in unittest.mock._get_target

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.7

___
Python tracker 

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



[issue29985] make install doesn't seem to support --quiet

2022-01-14 Thread Irit Katriel


Irit Katriel  added the comment:

Ken, the output you posted is for 3.7 and 3.8. Is this reproducible on 3.9+? 
(3.8 and lower are no longer maintained).

--
nosy: +iritkatriel

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Aviram


Aviram  added the comment:

I submitted a draft patch. Using TPFlags alone doesn't cut it as some types are 
excluded (bytes, str, bytearray) in sequence and same for mapping. I'm thinking 
of checking for those cases specifically as those are very very specific 
casings. Would love some input.

--

___
Python tracker 

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



[issue46381] Improve documentation of CFLAGS_NODIST, LDFLAGS_NODIST

2022-01-14 Thread Matthias Köppe

New submission from Matthias Köppe :

The documentation of
- https://docs.python.org/3.11/using/configure.html#envvar-CFLAGS
- https://docs.python.org/3.11/using/configure.html#envvar-CFLAGS_NODIST
- https://docs.python.org/3.11/using/configure.html#envvar-LDFLAGS
- https://docs.python.org/3.11/using/configure.html#envvar-LDFLAGS_NODIST
should explain more clearly that flags such as `-I`, `-L`, etc. and strict 
compiler flags such as `-Werror...` should not be put into `CFLAGS`, `LDFLAGS`, 
or it will make the resulting Python unusable for compiling user packages with 
extension modules via `distutils` and `setuptools`.

Various downstream packagers have provided misconfigured Pythons:
- Homebrew (https://trac.sagemath.org/ticket/31132, 
https://github.com/Homebrew/homebrew-core/pull/68528, resolved)
- Cygwin (https://trac.sagemath.org/ticket/33078, 
https://cygwin.com/pipermail/cygwin/2021-December/250302.html, resolved in a 
proposed package update)
- pyenv (https://trac.sagemath.org/ticket/32531, 
https://github.com/pyenv/pyenv/issues/2204, open)

So this appears to be a documentation / user education issue in CPython.

--
assignee: docs@python
components: Documentation
messages: 410586
nosy: docs@python, matthiaskoeppe
priority: normal
severity: normal
status: open
title: Improve documentation of CFLAGS_NODIST, LDFLAGS_NODIST
type: enhancement
versions: Python 3.10, Python 3.11, 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



[issue28206] signal.Signals not documented

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.11 -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue46381] Improve documentation of CFLAGS_NODIST, LDFLAGS_NODIST

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue46367] multiprocessing's "spawn" doesn't actually use spawn

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +vstinner
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue37295] Possible optimizations for math.comb()

2022-01-14 Thread Tim Peters


Tim Peters  added the comment:

Another trick, building on the last one: computing factorial(k) isn't cheap, in 
time or space, and neither is dividing by it. But we know it will entirely 
cancel out. Indeed, for each outer loop iteration, prod(p) is divisible by the 
current k. But, unlike as in Stefan's code, which materializes range(n, n-k, 
-1) as an explicit list, we have no way to calculate "in advance" which 
elements of p[] are divisible by what.

What we _can_ do is march over all of p[], and do a gcd of each element with 
the current k. If greater than 1, it can be divided out of both that element of 
p[], and the current k. Later, rinse, repeat - the current k must eventually be 
driven to 1 then.

But that slows things down: gcd() is also expensive.

But there's a standard trick to speed that too: as in serious implementations 
of Pollard's rho factorization method, "chunk it". That is, don't do it on 
every outer loop iteration, but instead accumulate the running product of 
several denominators first, then do the expensive gcd pass on that product.

Here's a replacement for "the main loop" of the last code that delays doing 
gcds until the running product is at least 2000 bits:

fold_into_p(n)

kk = 1
for k in range(2, k+1):
n -= 1
# Merge into p[].
fold_into_p(n)
# Divide by k.
kk *= k
if kk.bit_length() < 2000:
continue
for i, pi in enumerate(p):
if pi > 1:
g = gcd(pi, kk)
if g > 1:
p[i] = pi // g
kk //= g
if kk == 1:
break
assert kk == 1
showp()
return prod(x for x in p if x > 1) // kk

That runs in under half the time (for n=100, k=50), down to under 7.5 
seconds. And, of course, the largest denominator consumes only about 2000 bits 
instead of 50!'s 8,744,448 bits.

Raising the kk bit limit from 2000 to 1 cuts another 2.5 seconds off, down 
to about 5 seconds.

Much above that, it starts getting slower again.

Seems to hard to out-think! And highly dubious to fine-tune it based on a 
single input case ;-)

Curious: at a cutoff of 1 bits, we're beyond the point where Karatsuba 
would have paid off for computing denominator partial products too.

--
versions:  -Python 3.11

___
Python tracker 

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



[issue46133] Unclear whether one can (or how to) provide source to exec-generated code

2022-01-14 Thread Irit Katriel


Irit Katriel  added the comment:

The source code is read from a file. If there is no file you get OSError, as 
the docstring states.

--
nosy: +iritkatriel
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



[issue45569] Drop support for 15-bit PyLong digits?

2022-01-14 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset 025cbe7a9b5d3058ce2eb8015d3650e396004545 by Mark Dickinson in 
branch 'main':
bpo-45569: Change PYLONG_BITS_IN_DIGIT default to 30 (GH-30497)
https://github.com/python/cpython/commit/025cbe7a9b5d3058ce2eb8015d3650e396004545


--

___
Python tracker 

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



[issue45737] assertLogs to optionally not disable existing handlers

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
versions:  -Python 3.10, 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



[issue46317] Pathlib.rename isn't robust

2022-01-14 Thread Barney Gale


Barney Gale  added the comment:

Sounds good. Would you expose the `copy_function` argument in pathlib, or do 
something else (like `metadata=True`)?

--
nosy: +barneygale

___
Python tracker 

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



[issue46382] dataclass(slots=True) does not account for slots in base classes

2022-01-14 Thread Arie Bovenberg


New submission from Arie Bovenberg :

@dataclass(slots=True) adds slots to dataclasses. It adds a slot per field. 
However, it doesn't account for slots already present in base classes:

>>> class Base:
... __slots__ = ('a', )
...
>>> @dataclass(slots=True)
... class Foo(Base):
... a: int
... b: float
...
>>> Foo.__slots__
('a', 'b')  # should be: ('b', )


The __slots__ documentation says:

If a class defines a slot also defined in a base class, the instance 
variable 
defined by the base class slot is inaccessible (except by retrieving its 
descriptor 
directly from the base class). This renders the meaning of the program 
undefined. 
In the future, a check may be added to prevent this.

Solution: don't add slots which are already defined in any base classes:

>>> @dataclass
... class Bla(Base):
... __slots__ = ('b', )
... a: int
... b: float
...
>>> Bla(4, 5.65)
Bla(a=4, b=5.65)

If you agree, I'd like to submit a PR to fix this. I already have a prototype 
working.

--
components: Library (Lib)
messages: 410591
nosy: ariebovenberg
priority: normal
severity: normal
status: open
title: dataclass(slots=True) does not account for slots in base classes
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting

2022-01-14 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

[data] I finally dug up the old YouTube doc at work with their findings. Mostly 
just posting this here for future public reference if anyone wants. Nothing 
surprising.

When youtube experimented with a modified 2.7 adding "eternal refcounts" in 
2015, they saw a 3-5% CPU performance regression. (not the 10% I had in my mind)

Their version of this simply set a high bit on the refcount as the indicator 
and added the obvious conditional into the Py_INCREF/Py_DECREF macros.

Unsurprisingly in line with what others have since found. For their preforked 
server and decision of what to mark eternal before forking, it saved them 10% 
ram (fewer copy on writes). The -ram vs +cpu +maintenance cost tradeoff wound 
up not being worthwhile to them though. Their motivation for trying was 
entirely COW memory savings.

=== CPython 2.7 object.h modification they used:

```
+#ifdef GOOGLE_ETERNAL_REFCOUNT_SUPPORT
+
+#define PY_ETERNAL_REFCOUNT (PY_SSIZE_T_MAX / 2)
+
+#define Py_IS_ETERNAL(op) (   \
+  ((PyObject*)(op))->ob_refcnt >= PY_ETERNAL_REFCOUNT)
+
+#define Py_SET_ETERNAL(op)\
+  do {\
+  ((PyObject*)(op))->ob_refcnt = PY_ETERNAL_REFCOUNT; \
+  if (PyObject_IS_GC(op)) {   \
+PyObject_GC_UnTrack(op);  \
+  }   \
+  } while (0)
+
+#define Py_INCREF(op) (   \
+  Py_IS_ETERNAL(op)   \
+?  PY_ETERNAL_REFCOUNT\
+:  (_Py_INC_REFTOTAL  _Py_REF_DEBUG_COMMA \
+   ((PyObject*)(op))->ob_refcnt++)\
+  )
+
+#define Py_DECREF(op)   \
+do {\
+if (Py_IS_ETERNAL(op)) break;   \
+if (_Py_DEC_REFTOTAL  _Py_REF_DEBUG_COMMA   \
+--((PyObject*)(op))->ob_refcnt != 0)\
+_Py_CHECK_REFCNT(op)\
+else\
+_Py_Dealloc((PyObject *)(op));  \
+} while (0)
+
+#else
```

--

___
Python tracker 

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



[issue46317] Pathlib.rename isn't robust

2022-01-14 Thread Oz Tiram


Oz Tiram  added the comment:

@barney, I am not sure that I understand your question.

I think adding another method `Pathlib.Path` and `Pathlib._Accessor` is my 
preferred way. The would be something like:

class _NormalAccessor(_Accessor):
   ...
   self.move = shutil.move


class Path:
   

   def move(self, src, dest):
  self._accessor.move(self, target)
  return self.__class__(target)


Now, this is hardly a patch. I need to submit a PR with proper docs, tests and 
NEWS entry... I will be glad to work on it. However, I guess I need someone to 
"sponsor" it and merge it.

--

___
Python tracker 

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



[issue46383] _zoneinfo module_free has invalid function signature

2022-01-14 Thread Christian Heimes


New submission from Christian Heimes :

The zoneinfo C extension has the "freefunc m_free" function with signature 
"static void module_free(void)". The signature of freefunc is "void 
(*freefunc)(void *)". It takes a void * argument, but module_free() does not.

The signature mismatch is not a problem for most C compilers. But Web Assembly 
is more strict. wasm32-emscripten fails and aborts at runtime:

worker.js onmessage() captured an uncaught exception: RuntimeError: function 
signature mismatch
Pthread 0x8a1df0 sent an error! undefined:undefined: function signature mismatch

/python-wasm/cpython/builddir/node/python.js:158
   throw ex;
   ^
Error [RuntimeError]: function signature mismatch
at module_dealloc (:wasm-function[1883]:0x9a15e)
at _Py_Dealloc (:wasm-function[1959]:0x9eabe)
at insertdict (:wasm-function[1624]:0x87ccb)
at _PyDict_SetItem_Take2 (:wasm-function[1622]:0x8749c)
at dict_ass_sub (:wasm-function[1708]:0x8e604)
at PyObject_SetItem (:wasm-function[486]:0x34221)
at finalize_modules (:wasm-function[3644]:0x1703d0)
at Py_FinalizeEx (:wasm-function[3641]:0x16f986)
at Py_RunMain (:wasm-function[4055]:0x191124)
at pymain_main (:wasm-function[4058]:0x19174d)
Emitted 'error' event on process instance at:
at emitUnhandledRejectionOrErr (internal/event_target.js:579:11)
at MessagePort.[nodejs.internal.kHybridDispatch] 
(internal/event_target.js:403:9)
at MessagePort.exports.emitMessage 
(internal/per_context/messageport.js:18:26)

--
assignee: christian.heimes
components: Extension Modules
messages: 410594
nosy: christian.heimes, p-ganssle
priority: normal
severity: normal
status: open
title: _zoneinfo module_free has invalid function signature
type: crash
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue46383] _zoneinfo module_free has invalid function signature

2022-01-14 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-14 Thread Christian Heimes


Change by Christian Heimes :


--
dependencies: +_zoneinfo module_free has invalid function signature

___
Python tracker 

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



[issue46317] Pathlib.rename isn't robust

2022-01-14 Thread Barney Gale


Barney Gale  added the comment:

shutil.move() accepts a `copy_function` argument:

shutil.move(src, dst, copy_function=copy2)

It's possible to set `copy_function=copy` to skip copying file metadata.

--

___
Python tracker 

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



[issue46017] Tutorial incorrectly refers to skits rather than sketches.

2022-01-14 Thread Irit Katriel


Irit Katriel  added the comment:

I asked a Monty Python expert and he said I should close this.

--
nosy: +iritkatriel
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



[issue46133] Feature request: allow mechanism for creator of exec-generated code to provide source to pdb

2022-01-14 Thread Matt B


Change by Matt B :


--
status: closed -> open
title: Unclear whether one can (or how to) provide source to exec-generated 
code -> Feature request: allow mechanism for creator of exec-generated code to 
provide source to pdb
type: behavior -> enhancement

___
Python tracker 

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



[issue46133] Feature request: allow mechanism for creator of exec-generated code to provide source to pdb

2022-01-14 Thread Matt B


Change by Matt B :


--
resolution: not a bug -> 

___
Python tracker 

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



[issue46133] Feature request: allow mechanism for creator of exec-generated code to provide source to pdb

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
stage: resolved -> 
versions:  -Python 3.10, Python 3.6, 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



[issue46133] Feature request: allow mechanism for creator of exec-generated code to provide source to pdb

2022-01-14 Thread Irit Katriel


Change by Irit Katriel :


--
nosy:  -iritkatriel

___
Python tracker 

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



[issue46133] Feature request: allow mechanism for creator of exec-generated code to provide source to pdb

2022-01-14 Thread Matt B


Matt B  added the comment:

Please treat this as a feature request to add the ability for pdb (and 
internals) to ingest sources for exec-generated code.

--

___
Python tracker 

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



[issue46380] `test_functools.TestLRU` must not use `functools` module directly

2022-01-14 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Markus, thank you for the suggestion but I'm going to decline.  When this rough 
equivalent was first created, we looked at several recipes and chose this one 
as being one of the least magical.  Intentionally, we did not use the variant 
you've proposed.  To a person well versed in recursion and in generator chains 
it makes sense but not so much for anyone else.  Plus it is hard to step 
through by hand to see what it is doing.

In general, the rough equivalents were intended to a way to understand what 
output is going to be generated.  That is why they are mostly simple rather 
than being faithful to the actual implementations (otherwise, we would use 
classes rather than generators for all the equivalents).  Viewed in this light, 
we place almost zero weight to making the recipe memory efficient with respect 
to temporary variables.

--
resolution:  -> rejected
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



[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Please do keep looking for improvements.  Suggestions are always welcome.

--

___
Python tracker 

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



[issue46380] `test_functools.TestLRU` must not use `functools` module directly

2022-01-14 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset c5640ef87511c960e339af37b486678788be910a by Nikita Sobolev in 
branch 'main':
bpo-46380: Apply tests to both C and Python version (GH-30606)
https://github.com/python/cpython/commit/c5640ef87511c960e339af37b486678788be910a


--

___
Python tracker 

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



[issue46380] `test_functools.TestLRU` must not use `functools` module directly

2022-01-14 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



  1   2   >