[issue45630] Dump CodeObject API for debugging

2021-12-09 Thread penguin_wwy


penguin_wwy <940375...@qq.com> added the comment:

Recently, we have used this function to troubleshoot problems with online 
applications.
We have implemented the PEP659(Specializing) to the 3.6 version which is used 
by online services, and this function allows us to dump the current function's 
code in the case of an unhandled exception to determine if the problem was 
caused by an optimization.

--

___
Python tracker 

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



[issue46030] socket module add couple of FreeBSD constants

2021-12-09 Thread David Carlier


New submission from David Carlier :

- adding LOCAL_CREDS then LOCAL_CREDS_PERSISTENT and SCM_CREDS2 which would be 
used as msg type for the latter.

--
components: FreeBSD
messages: 408175
nosy: dcarlier, koobs
priority: normal
pull_requests: 28242
severity: normal
status: open
title: socket module add couple of FreeBSD constants
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



[issue39327] shutil.rmtree using vagrant synched folder fails

2021-12-09 Thread Lasse Kantola


Lasse Kantola  added the comment:

I have encountered the same problem with vboxsf mounted folders when using 
Debian guest on VirtualBox 6.1 hosted by Windows 10.

The general VirtualBox issue of vboxsf not supporting rmdir when there are open 
file descriptors is difficult to solve, and out of scope for Python.

However, it looks like the shutil.rmtree implementation can be easily modified 
to change the order of operations so that the rmdir is performed after the 
directory file descriptor is closed, which makes shutil.rmtree work under 
vboxsf shared folders.

Example of the change against Python 3.7 is inlined below. The changed order 
matches the behavior of "rm -r" and to my understanding should not change the 
security implications of the code, but as the code is related to the prevention 
of a symlink attack https://bugs.python.org/issue4489 careful review would be 
needed.


--- /usr/lib/python3.7/shutil.py--orig  2021-01-23 05:04:44.0 +0900
+++ /usr/lib/python3.7/shutil.py2021-12-09 20:42:36.795338346 +0900
@@ -427,10 +427,6 @@
 try:
 if os.path.samestat(orig_st, os.fstat(dirfd)):
 _rmtree_safe_fd(dirfd, fullname, onerror)
-try:
-os.rmdir(entry.name, dir_fd=topfd)
-except OSError:
-onerror(os.rmdir, fullname, sys.exc_info())
 else:
 try:
 # This can only happen if someone replaces
@@ -442,6 +438,10 @@
 onerror(os.path.islink, fullname, sys.exc_info())
 finally:
 os.close(dirfd)
+try:
+os.rmdir(entry.name, dir_fd=topfd)
+except OSError:
+onerror(os.rmdir, fullname, sys.exc_info())
 else:
 try:
 os.unlink(entry.name, dir_fd=topfd)
@@ -489,10 +489,6 @@
 try:
 if os.path.samestat(orig_st, os.fstat(fd)):
 _rmtree_safe_fd(fd, path, onerror)
-try:
-os.rmdir(path)
-except OSError:
-onerror(os.rmdir, path, sys.exc_info())
 else:
 try:
 # symlinks to directories are forbidden, see bug #1669
@@ -501,6 +497,10 @@
 onerror(os.path.islink, path, sys.exc_info())
 finally:
 os.close(fd)
+try:
+os.rmdir(path)
+except OSError:
+onerror(os.rmdir, path, sys.exc_info())
 else:
 try:
 if os.path.islink(path):

--
nosy: +lkantola

___
Python tracker 

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



[issue46029] "ValueError: Invalid isoformat string" from a valid string

2021-12-09 Thread oittaa


New submission from oittaa :

Test case:

>>> import datetime
>>> datetime.datetime.fromisoformat('2021-12-10T01:00:00Z')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Invalid isoformat string: '2021-12-10T01:00:00Z'


Basically every other programming language I tested correctly accepted this 
ISO/RFC3339 string as a date.

--
messages: 408173
nosy: oittaa
priority: normal
severity: normal
status: open
title: "ValueError: Invalid isoformat string" from a valid string
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



[issue43931] Add the Python version to the API data.

2021-12-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-09 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

On Fri, Dec 10, 2021 at 12:03:15AM +, Gabriele N Tornetta wrote:

> class Side(object):
> def __getattribute__(self, name):
> ValueError(name)

You forgot to actually *raise* the exception. That will just instantiate
the ValueError instance, and then immediately garbage collect it.

In any case, type() and isinstance() do not work the same way. type()
does not inspect the `__class__` attribute.

--

___
Python tracker 

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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-09 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I agree that the rules regarding type and `__class__` and isinstance are 
not clear or well documented.

We have:

https://docs.python.org/3/library/stdtypes.html#instance.__class__

https://docs.python.org/3/library/functions.html#isinstance

but neither discuss the interaction between a class' "real" type and 
it's "fake" type.

To be honest, I'm not even sure I fully understand the interaction 
myself, or how they combine with virtual subclasses. A lot of my 
information comes from this Stackoverflow post:

https://stackoverflow.com/questions/1060499/difference-between-typeobj-and-obj-class

and in particular this comment:

"Some code does this deliberately to lie about the type of objects, such 
as weakref.proxy. Some people think obj.__class__ should be preferred, 
because it believes the lie, while some people think type(obj) should be 
preferred because it ignores the lie. isinstance will return true if an 
object's real class or its lie class is an instance of the second 
argument."

So I think that the behaviour here is correct, but it is not documented 
well and we should fix that.

What I think happens:

* type(obj) always and only returns the actual internal (C-level) type 
  of the object, guaranteed to be a type object.

* isinstance(obj, classinfo) returns True if any of the following hold:

  - the type() of object is a subclass of any of the classes in the
classinfo object (a class, a Union of classes, or a tuple of 
classes);

  - obj.__class__ is a subclass of any of the classes in classinfo;

  - or obj is registered as a virtual subclass of any of the classes
in classinfo, by calling type(ob).__subclasshook__;

* obj.__class__ is determined using the normal attribute lookup 
  mechanism, which means it does not have to be a static attribute
  but can be dynamically generated using properties, __getattr__,
  __getattribute__ or any other similar mechanism.

And for the avoidance of doubt, a class is always considered a subclass 
of itself.

I'm really not sure about the interaction with virtual subclasses, I 
probably have that bit wrong. And it is not clear to me what happens if 
__class__ is a non-type object. It seems to be permitted.

Improving the documentation would be excellent.

--

___
Python tracker 

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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Changing the way isinstance works internally might prove
> beneficial for such tools.

ISTM you're advocating a design change rather than discussing a bug report.  
The python-ideas mail list would be a better forum than the tracker.

--
nosy: +rhettinger

___
Python tracker 

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



[issue43931] Add the Python version to the API data.

2021-12-09 Thread miss-islington


miss-islington  added the comment:


New changeset 50669083fe16a42cba90b5dd8c1a017751f69fd8 by Gabriele N. Tornetta 
in branch 'main':
bpo-43931: Export Python version as API data (GH-25577)
https://github.com/python/cpython/commit/50669083fe16a42cba90b5dd8c1a017751f69fd8


--
nosy: +miss-islington

___
Python tracker 

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



[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Ned, are you able to bisect this or provide a simpler reproducer that doesn't 
involve tox?

--

___
Python tracker 

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



[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
priority: normal -> release blocker

___
Python tracker 

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



[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Steve, could this be related to the changes in getpath?

--
nosy: +steve.dower

___
Python tracker 

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



[issue46014] functools.singledispatch does not support Union types

2021-12-09 Thread Yurii Karabas


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


--
keywords: +patch
nosy: +uriyyo
nosy_count: 4.0 -> 5.0
pull_requests: +28241
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30017

___
Python tracker 

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



[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-09 Thread Ned Batchelder


New submission from Ned Batchelder :

Under tox, sys._base_executable is not an actual file for 3.11.0a3.  It was 
fine in 3.11.0a2.

To reproduce:

--- 8< 
# tox.ini
[tox]
envlist = py{310,311a2,311}
skipsdist = True

[testenv]
commands =
python -c "import sys,os.path; print(e := sys._base_executable); 
print(os.path.exists(e))"

[testenv:py311a2]
# This is the path to 3.11.0a2 if you have it.
basepython = /usr/local/pyenv/pyenv/versions/3.11.0a2/bin/python3


Create a new Python 3.8 virtualenv, and install latest tox (3.24.4 for me).

Then run "tox".  I see:


py310 create: /Users/nedbatchelder/coverage/lab/fix-3.11a3/.tox/py310
py310 run-test-pre: PYTHONHASHSEED='534434199'
py310 run-test: commands[0] | python -c 'import sys,os.path; print(e := 
sys._base_executable); print(os.path.exists(e))'
/Users/nedbatchelder/coverage/lab/fix-3.11a3/.tox/py310/bin/python
True
py311a2 create: /Users/nedbatchelder/coverage/lab/fix-3.11a3/.tox/py311a2
py311a2 run-test-pre: PYTHONHASHSEED='534434199'
py311a2 run-test: commands[0] | python -c 'import sys,os.path; print(e := 
sys._base_executable); print(os.path.exists(e))'
/Users/nedbatchelder/coverage/lab/fix-3.11a3/.tox/py311a2/bin/python
True
py311 create: /Users/nedbatchelder/coverage/lab/fix-3.11a3/.tox/py311
py311 run-test-pre: PYTHONHASHSEED='534434199'
py311 run-test: commands[0] | python -c 'import sys,os.path; print(e := 
sys._base_executable); print(os.path.exists(e))'
/usr/local/pyenv/pyenv/versions/3.11.0a3/python
False
_ summary 
_
  py310: commands succeeded
  py311a2: commands succeeded
  py311: commands succeeded
  congratulations :)


This came to my attention because the coverage.py test suite uses "python -m 
venv" to create environments. They worked under 3.11.0a2, but failed under a3.  
I tracked it down to a difference in sys._base_executable.

I couldn't see a difference in those values without tox, but I'm not sure why 
it changes the results.

--
keywords: 3.11regression
messages: 408166
nosy: nedbat, pablogsal
priority: normal
severity: normal
status: open
title: 3.11.0a3: under tox, sys._base_executable is wrong
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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-09 Thread Gabriele N Tornetta


Gabriele N Tornetta  added the comment:

> Python is very much a language about responsibility.  If Django is overriding 
> `__getattribute__` then it is their responsibility to ensure that everything 
> still works properly.

Perhaps I didn't stress observability enough. A tool like a tracer or a 
profiler, in the ideal world, is not supposed to perturb the tracee in any way. 
The current implementation of isinstance, when used by an observability tool, 
may cause side effects as well as overheads, so it is not safe to use in such 
tools. Working around it may solve the side-effects issue, but leaves the 
problem of overheads. Changing the way isinstance works internally might prove 
beneficial for such tools.

En passant,  I think it should be noted that the built-in "type" doesn't suffer 
from the same problem, i.e.

~~~
class Side(object):
def __getattribute__(self, name):
ValueError(name)


type(Side())
~~~

works as expected.

--

___
Python tracker 

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



[issue27583] [doc ] configparser: modifying default_section at runtime

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
title: configparser: modifying default_section at runtime -> [doc ] 
configparser: modifying default_section at runtime
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.5, 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



[issue20823] [doc] Clarify copyreg.pickle() documentation

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy -patch
title: Clarify copyreg.pickle() documentation -> [doc] Clarify copyreg.pickle() 
documentation
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.5, 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



[issue17108] [doc] import silently prefers package over module when both available

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
title: import silently prefers package over module when both available -> [doc] 
import silently prefers package over module when both available
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.3, Python 
3.4

___
Python tracker 

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



[issue46016] fcntl module add F_DUP2FD_CLOEXEC

2021-12-09 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset da3cf4304f6dd530533bbd2c0913b674cd803744 by Victor Stinner in 
branch 'main':
bpo-46016: GHA Doc job now also runs "make check" (GH-30009)
https://github.com/python/cpython/commit/da3cf4304f6dd530533bbd2c0913b674cd803744


--

___
Python tracker 

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



[issue7262] [doc] codecs.open() + eol (windows)

2021-12-09 Thread Irit Katriel


Irit Katriel  added the comment:

That paragraph was edited here:

https://github.com/python/cpython/commit/b9fdb7a452c2b6f7a628118b5f695bd061b62cc8


but this point was not added.

--
nosy: +iritkatriel
title: codecs.open() + eol (windows) -> [doc] codecs.open() + eol (windows)
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.3, Python 
3.4

___
Python tracker 

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



[issue45774] Detect SQLite in configure.ac

2021-12-09 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue26159] Unsafe to BaseEventLoop.set_debug(False) when PYTHONASYNCIODEBUG=1

2021-12-09 Thread Irit Katriel


Irit Katriel  added the comment:

asyncio.coroutine was removed in 3.10, so this is no longer relevant.

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



[issue45774] Detect SQLite in configure.ac

2021-12-09 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Reopening: the current detection is a little bit weak; many SQLite API's may be 
disabled at SQLite compile time using SQLITE_OMIT_* defines. We must make sure 
we've got all vital functions in place before marking the sqlite3 module as 
present and usable.

The following API's can be omitted using compile time defines:

- sqlite3_column_decltype (SQLITE_OMIT_DECLTYPE)
- sqlite3_complete (SQLITE_OMIT_COMPLETE)
- sqlite3_enable_shared_cache (SQLITE_OMIT_SHARED_CACHE)
- sqlite3_progress_handler (SQLITE_OMIT_PROGRESS_CALLBACK)
- sqlite3_set_authorizer (SQLITE_OMIT_AUTHORIZATION)
- sqlite3_trace_v2 (SQLITE_OMIT_TRACE)
- sqlite3_trace (SQLITE_OMIT_TRACE, SQLITE_OMIT_DEPRECATED)


The following API's _may_ be disabled in the future using 
SQLITE_OMIT_FLOATING_POINT:

- sqlite3_bind_double
- sqlite3_column_double
- sqlite3_result_double
- sqlite3_value_double

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

___
Python tracker 

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



[issue20420] BufferedIncrementalEncoder violates IncrementalEncoder interface

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


--
components: +Library (Lib)
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.3, Python 
3.4

___
Python tracker 

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



[issue12038] assertEqual doesn't display newline differences quite well

2021-12-09 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.3

___
Python tracker 

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



[issue36048] Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__

2021-12-09 Thread Calin Culianu


Calin Culianu  added the comment:

Ok, Guido, thanks. Fair enough.

So regardless: what is the problem exactly if a C function expects an int but 
gets given a float? Why does such strictness matter, in that it required a 
whole other set of __index__ etc to be added?  I am having trouble seeing the 
actual problem, which was taken as a given in all the archaeology I have done 
on this ancient "issue" -- but is it a given?  There is no problem... only the 
one created by this change, really.

--

___
Python tracker 

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



[issue46008] Prepare runtime/interp/thread state and init for upcoming changes.

2021-12-09 Thread Eric Snow


Eric Snow  added the comment:


New changeset c8749b578324ad4089c8d014d9136bc42b065343 by Eric Snow in branch 
'main':
bpo-46008: Make runtime-global object/type lifecycle functions and state 
consistent. (gh-29998)
https://github.com/python/cpython/commit/c8749b578324ad4089c8d014d9136bc42b065343


--

___
Python tracker 

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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread miss-islington


miss-islington  added the comment:


New changeset ca08655b808aed2e3abeb64cb67d98a79a661dda by Miss Islington (bot) 
in branch '3.10':
bpo-46018: Ensure that math.expm1 does not raise on underflow (GH-29997)
https://github.com/python/cpython/commit/ca08655b808aed2e3abeb64cb67d98a79a661dda


--

___
Python tracker 

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



[issue36048] Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__

2021-12-09 Thread Guido van Rossum


Guido van Rossum  added the comment:

Claim, you need to tone down the rhetoric. Python is not C++ and user 
expectations are different. You are the one who is fighting windmills here.

--

___
Python tracker 

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



[issue14965] super() and property inheritance behavior

2021-12-09 Thread Ronny Pfannschmidt


Ronny Pfannschmidt  added the comment:

im on the noisy list because i  faced this first in 2012

a key problem where i ran into this was mixins, - depending on whether a mixin 
was added or not one would get errors or not

from  my pov a super object should look like the "next class"

so properties of the next base should behave as such, special methods as well

--

___
Python tracker 

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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread miss-islington


miss-islington  added the comment:


New changeset 5ae4265b8c8042c496e569b6dbf9ef107e1d5b31 by Miss Islington (bot) 
in branch '3.9':
bpo-46018: Ensure that math.expm1 does not raise on underflow (GH-29997)
https://github.com/python/cpython/commit/5ae4265b8c8042c496e569b6dbf9ef107e1d5b31


--

___
Python tracker 

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



[issue36048] Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__

2021-12-09 Thread Calin Culianu


Calin Culianu  added the comment:

Ok, well I found this in that issue you linked to:

This is the original "problem":

```
type __mul__ is wierd:

>> 'a'.__mul__(3.4)
'aaa'
>>> [1].__mul__(3.4)
[1, 1, 1]
```

And this is Guido's response:

> The problem is that on the one hand you want "i" to accept
other int-ish types that have an __int__ method. But on the
other hand you don't want it to accept float, which also has
an __int__ method. Or other float-ish types.

--- 

You have to understand -- I don't see a problem here!

Not once is there any discussion as to *why* this is really a problem. So what? 
Your float gets truncated and treated as an int.  So?

If you are calling into a C api -- why is this a problem exactly when **in the 
C Language itself** by convention and by compiler rules anyway -- this is 
**perfectly ok**.

Restricting Python in this way -- why? What is the benefit? What problem is 
being solved? I did all the digging in the world here and cannot at all discern 
what, exactly, is being solved at all.  It seems like some bizarre aesthetic 
thing, at best.  Sorry.. maybe I am wrong.  Please point me to where the real 
problem is... 

Again, I reiterate **mathematically**, by convention in computer science, the 
conversion from float -> int is well defined.  Moreover, you have the legacy 
__int__ method already that *can define it* for specific types. And Python has 
worked this way since the age of the dinosaurs (2002!!).

So.. in python this conversion is well defined. And has always been, by __int__.

I think the introduction of __index__ versus __int__ may be a mistake, 
especially if it is designed to "solve" just this problem -- which as yet, has 
to be clearly argued for as to **why** it's a problem!

This boggles my mind, guys. I.. am speechless.  Please tell me I'm wrong. To me 
it seems you guys imagined a problem that doesn't exist, then "solved" it with 
extra API stuff, and the actual end result was -- real-world problems created 
ex-nihilo for real-world programs, manifesting themselves finally in 2021.

You have to understand that .. to me as a C++ programmer.. I see no problem. I 
just see Python all of a sudden becoming less nice.

--

___
Python tracker 

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



[issue45635] Tidy up error handling in traceback.c / python run.c

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +28239
pull_request: https://github.com/python/cpython/pull/30015

___
Python tracker 

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



[issue27315] pydoc: prefer the pager command in favor of the specifc less command

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


--
type:  -> enhancement
versions: +Python 3.11 -Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue45582] Rewrite getpath.c in Python

2021-12-09 Thread neonene


Change by neonene :


--
pull_requests: +28238
pull_request: https://github.com/python/cpython/pull/30014

___
Python tracker 

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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread Steve Dower


Steve Dower  added the comment:


New changeset 3363e1cb05d0d19ed172ea63606d8cb6268747fc by Steve Dower in branch 
'main':
bpo-46018: Ensure that math.expm1 does not raise on underflow (GH-29997)
https://github.com/python/cpython/commit/3363e1cb05d0d19ed172ea63606d8cb6268747fc


--

___
Python tracker 

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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28237
pull_request: https://github.com/python/cpython/pull/30013

___
Python tracker 

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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington, miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +28234, 28235
pull_request: https://github.com/python/cpython/pull/30012

___
Python tracker 

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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington, miss-islington, miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +28234, 28235, 28236
pull_request: https://github.com/python/cpython/pull/30012

___
Python tracker 

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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +28234
pull_request: https://github.com/python/cpython/pull/30012

___
Python tracker 

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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread Mark Dickinson


Mark Dickinson  added the comment:

> Lines 500-504 are the ones that trigger it.

Ah, right. Thanks.

> Apparently there are no tests in that file for straight exp()

Yes - that file was mostly written to give good coverage for places where we'd 
written our own implementations rather than simply wrapping an existing libm 
function, though I think we've now reverted to using the libm expm1 in all 
cases.

--

___
Python tracker 

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



[issue36048] Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__

2021-12-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See issue660144 which made float values be rejected in most cases where an 
integer is expected rather of silently truncating them. It was at 2003. Guido 
mentioned that is an age-old problem, so perhaps you can find older discussions 
on the tracker or mailing lists.

It was a partial solution. It caught unexpected floats, but not other 
non-integer numbers. Later, the __index__ special method was introduced 
specially to distinguish objects which can be implicitly converted to integer 
from these which can be explicitly converted to integer. And finally we fixed 
that age-old problem.

If you have other questions, please ask them on mailing lists, forums or other 
resources.

--

___
Python tracker 

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



[issue44525] Implement CALL_FUNCTION adaptive interpreter optimizations

2021-12-09 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +28233
pull_request: https://github.com/python/cpython/pull/30011

___
Python tracker 

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



[issue46027] email.utils.parsedate_to_datetime() handling of -0000 offset

2021-12-09 Thread Fred Drake


New submission from Fred Drake :

A local time offset of '-' is not handled the same way as an offset of 
'+', but I'd expect it would be:

>>> import email.utils
>>> 
>>> email.utils.parsedate_to_datetime('9 Dec 2021 08:52:04 -')
datetime.datetime(2021, 12, 9, 8, 52, 4)
>>> email.utils.parsedate_to_datetime('9 Dec 2021 08:52:04 +')
datetime.datetime(2021, 12, 9, 8, 52, 4, tzinfo=datetime.timezone.utc)

I observe the same behavior on Python 3.9.9 and 3.10.1.

--
components: email
messages: 408149
nosy: barry, fdrake, r.david.murray
priority: normal
severity: normal
status: open
title: email.utils.parsedate_to_datetime() handling of - offset
type: behavior
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread Steve Dower


Steve Dower  added the comment:

Lines 500-504 are the ones that trigger it. Apparently there are no tests in 
that file for straight exp(), but the equivalent tests for those would return 
0.0 and suppress ERANGE too.

--

___
Python tracker 

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



[issue46025] Raising in an atexit function in dev mode crashes

2021-12-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

>For me, the question is why would anyone call atexit.unregister() inside an 
>atexit callback. Is it useful?

Is not useful, is just an edge case

--

___
Python tracker 

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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread Mark Dickinson


Mark Dickinson  added the comment:

> I've also got no idea how to write a test for this

Yep, that's fine. All I want is that at least one particular value that caused 
the spurious OverflowError is in the test suite somewhere, but it sounds as 
though that's already the case. I'd imagine that one of these two testcases 
should be enough to trigger it:

https://github.com/python/cpython/blob/44b0e76f2a80c9a78242b7542b8b1218d244af07/Lib/test/math_testcases.txt#L495-L496

--

___
Python tracker 

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



[issue36048] Deprecate implicit truncating when convert Python numbers to C integers: use __index__, not __int__

2021-12-09 Thread Calin Culianu


Calin Culianu  added the comment:

Hi, I'm cculianu, the reporting user.

May I get a link or some background for the motivation for this change? It 
seems to me that there are vague allusions to "Decimal -> int cause problems in 
past", or some such, and I'd like to read the arguments presented as to what 
problems in particular, and how this change fixes those problems.

Mathematically, and by convention in computer science, conversions from 
float-like types -> int are always well defined.  It seems strangely 
un-Pythonic to restrict things in such a way.  I am very surprised by this 
change, quite frankly.  It's the wrong direction to go in, for this language, 
is my intuitive feeling.

Anyway, very curious about what the rationale was for this. Thanks.

--
nosy: +calin.culianu

___
Python tracker 

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



[issue46025] Raising in an atexit function in dev mode crashes

2021-12-09 Thread STINNER Victor


STINNER Victor  added the comment:

For me, the question is why would anyone call atexit.unregister() inside an 
atexit callback. Is it useful?

atexit._run_exitfuncs() removes all registered callbacks.

Py_Finalize() calls _PyAtExit_Call() which also removes all registered 
callbacks.

--

___
Python tracker 

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



[issue46025] Raising in an atexit function in dev mode crashes

2021-12-09 Thread STINNER Victor


STINNER Victor  added the comment:

Interesting bug report! Thanks for the fix ;-)

--

___
Python tracker 

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



[issue45654] Freeze the runpy module.

2021-12-09 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks Kumar!

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



[issue45654] Freeze the runpy module.

2021-12-09 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 44b0e76f2a80c9a78242b7542b8b1218d244af07 by Kumar Aditya in 
branch 'main':
bpo-45654: Freeze the runpy module and stuff it imports (GH-29903)
https://github.com/python/cpython/commit/44b0e76f2a80c9a78242b7542b8b1218d244af07


--
nosy: +gvanrossum

___
Python tracker 

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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-09 Thread Ethan Furman


Ethan Furman  added the comment:

$ python3
Python 3.8.10 (default, Sep 28 2021, 16:10:42) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> object


>>> import builtins
>>> builtins.object


>>> builtins.object = int
>>> object



Python is very much a language about responsibility.  If Django is overriding 
`__getattribute__` then it is their responsibility to ensure that everything 
still works properly.  If something doesn't, we file a bug report and/or 
implement a work-around.

As for side-effect free -- I'm not sure than anything in Python is guaranteed 
to be side-effect free, except maybe `is`.

There is no bug here, everything is working as intended.

--
nosy: +ethan.furman

___
Python tracker 

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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread Steve Dower


Steve Dower  added the comment:

I've also got no idea how to write a test for this, given that it's a very thin 
wrapper around a platform's C runtime library. Our existing test discovered 
when the library changed behaviour to start setting errno, which is probably 
the best we can do.

--

___
Python tracker 

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



[issue46024] Different behaviour with zipfile

2021-12-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

What does "path" (the input to ZipPath) look like?

Please change your print statement to:
print(repr(path), ZipPath(path).name)

Then send us the output from each version of python.

--
nosy: +eric.smith

___
Python tracker 

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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread Steve Dower


Steve Dower  added the comment:

I considered just switching to <2.0, but wasn't sure if I would be breaking 
some other unspoken behaviour there. But you're right, it's really just 
detecting underflow vs. overflow, so that's a much simpler way to check.

I've filed the upstream report. I suspect the errno is coming from the exp() 
call within the expm1() implementation, so it's underflowing towards 0.0 and 
then subtracting 1.

--

___
Python tracker 

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



[issue46016] fcntl module add F_DUP2FD_CLOEXEC

2021-12-09 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28232
pull_request: https://github.com/python/cpython/pull/30009

___
Python tracker 

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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-09 Thread Gabriele N Tornetta


Gabriele N Tornetta  added the comment:

> I tend to agree with Steven and David here. You define __getattribute__ and 
> so that's the behaviour you get when an attribute of the class is requested 
> (whether by the system or by your code).

I would agree if it was obvious or explicitly stated that isinstance looks up 
__class__ using the object's __getattribute__, and thus prone to cause 
side-effects. It wasn't obvious to me that isinstance would access any 
attributes from the object, but that it would rather get the object's type in a 
more direct way (at the C level for CPython).

> Do you have a real-world example of code that is broken by this behaviour, or 
> is this just a theoretical problem?

I was looking at some profiling data for a real-life project (observability) 
that I'm working on. I was using a simple Django application as a target and 
noticed calls to a __getattribute__ (implemented by a Django class) that I 
wasn't expecting. All my code was doing was to check that a certain object was 
not of "callable" type using isinstance. Whilst I believe no side effects were 
caused by this particular instance of __getattribute__, it should be noted that 
"Django" is a variable here: any other target framework or library might have 
caused side effects in theory. The code that I want to execute must have 
guarantees of being side-effects-free, so using isinstance does not give me 
that. Currently, I have worked around this by using a custom, pure Python 
implementation of isinstance that gets __mro__  (via object.__getattribute__) 
and checks that type(obj) is an element of it (plus caching, for performance 
reasons).

--

___
Python tracker 

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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-09 Thread Paul Moore


Paul Moore  added the comment:

I tend to agree with Steven and David here. You define __getattribute__ and so 
that's the behaviour you get when an attribute of the class is requested 
(whether by the system or by your code). The documentation (here: 
https://docs.python.org/3/reference/datamodel.html#object.__getattribute__) 
seems to support this view as well.

Do you have a real-world example of code that is broken by this behaviour, or 
is this just a theoretical problem? Is it particularly hard to make the code 
work the way you want it to with the current behaviour? For example,

# Don't intercept __class__
if attr == "__class__":
return object.__getattribute__(self, attr)

--
nosy: +paul.moore

___
Python tracker 

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



[issue45949] Provide pure-Python implementation of Programs/_freeze_module for cross building

2021-12-09 Thread Christian Heimes


Christian Heimes  added the comment:

Eric, could you review my PR, please? It simplifies cross building to other 
platforms.

I took a look at Tools/freeze/freeze.py. The freeze tool creates different 
output than Program/_freeze_module.c.

--

___
Python tracker 

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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-09 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

If you don't want to customise attribute access, don't overload 
`__getattribute__`. The documentation for `__getattribute__` is clear 
about what it does:

"Called unconditionally to implement attribute accesses for instances of 
the class."

https://docs.python.org/3/reference/datamodel.html#object.__getattribute__

That includes lookups for `__class__`, regardless of whether the 
function doing the lookup is isinstance or some other function.

You ask:

"Are there any reasons why __class__ cannot be retrieved with
object.__getattribute__ instead?"

Yes, that would ignore overloaded attribute access, which would be a 
bug in my opinion.

Being able to dynamically generate computed attributes by overloading 
`__getattr__` and `__getattribute__` is not a bug. It is part of 
Python's data model. See the documentation above.

And that includes `__class__`.

I don't believe that it is an accident or a bug that isinstance uses 
ordinary attribute lookup, which goes through the standard mechanism 
including the class' own `__getattribute__` method. But I will ask on 
the Python-Dev mailing list in case Guido or other core developers think 
that it is wrong to do so.

--

___
Python tracker 

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



[issue46025] Raising in an atexit function in dev mode crashes

2021-12-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 934a24c641da5bc4bdb724e901adc20f9a5dff40 by Miss Islington (bot) 
in branch '3.10':
bpo-46025: Fix a crash in the atexit module for auto-unregistering functions 
(GH-30002) (GH-30005)
https://github.com/python/cpython/commit/934a24c641da5bc4bdb724e901adc20f9a5dff40


--

___
Python tracker 

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



[issue46025] Raising in an atexit function in dev mode crashes

2021-12-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue42943] singledispatchmethod should expose registry of all known overloads

2021-12-09 Thread hongweipeng


Change by hongweipeng :


--
keywords: +patch
nosy: +hongweipeng
nosy_count: 5.0 -> 6.0
pull_requests: +28231
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30007

___
Python tracker 

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



[issue43112] SOABI on Linux does not distinguish between GNU libc and musl libc

2021-12-09 Thread Dave Shawley


Change by Dave Shawley :


--
nosy: +dave-shawley

___
Python tracker 

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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-09 Thread Gabriele N Tornetta


Gabriele N Tornetta  added the comment:

I think the issue on display here is that isinstance could cause a side effect, 
which I dare say it's unexpected (and not documented AFAIK). Are there any 
reasons why __class__ cannot be retrieved with object.__getattribute__ instead? 
In fact, considering that __getattribute__ could be overridden, this would be 
the right thing to do imho, else isinstance would break spectacularly, like in 
my previous example.

--

___
Python tracker 

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



[issue46011] Python 3.10 email returns invalid Date: header unchanged.

2021-12-09 Thread R. David Murray


R. David Murray  added the comment:

Yeah, I think there may be a general issue with getting header defects 
reflected somehow in message.defects, but that's a separate issue :)

--

___
Python tracker 

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



[issue45635] Tidy up error handling in traceback.c / python run.c

2021-12-09 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset dc4a212bd305831cb4b187a2e0cc82666fcb15ca by Irit Katriel in 
branch 'main':
bpo-45635: continue refactor of print_exception() to standardize error handling 
(GH-29996)
https://github.com/python/cpython/commit/dc4a212bd305831cb4b187a2e0cc82666fcb15ca


--

___
Python tracker 

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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-09 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I'd be inclined to see this as a bug in your code, if you are causing 
side-effects from `__getattribute__`. If you don't want attribute access to 
cause side-effects, then don't put code in `__getattribute__` that causes 
side-effects :-)

isinstance has to check the object's `__class__`, if it has one. To do that it 
has to look at obj.__class__, which your class intercepts using 
`__getattribute__` and causes a side-effect.

Overloading `__getattribute__` is perilous, because it intercepts *all* 
instance attribute lookups. In my opinion, one should (almost?) never overload 
the `__getattribute__` method, it is safer to overload `__getattr__`.

In any case, I don't think there is anything to fix here. Dan has not responded 
since his initial bug report nearly four years ago, so I'm inclined to close 
this as "Not A Bug". Unless somebody gives a more convincing reason why the 
current behaviour is wrong, I think we should close it.

--

___
Python tracker 

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



[issue21042] ctypes.util.find_library() should return full pathname instead of filename in linux

2021-12-09 Thread Charles Coulombe


Charles Coulombe  added the comment:

Any update on this issue? 

This would be helpful to HPC systems that don't have libraries installed in 
standard place, and to standardize find_library as well!

--
nosy: +Charles Coulombe
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



[issue46016] fcntl module add F_DUP2FD_CLOEXEC

2021-12-09 Thread Christian Heimes


Change by Christian Heimes :


--
priority: release blocker -> normal
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



[issue46016] fcntl module add F_DUP2FD_CLOEXEC

2021-12-09 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset b123ad8030a4ad15c8dbb7cb3638caf625943878 by Kumar Aditya in 
branch 'main':
bpo-46016: Fix rest syntax of GH-29993 (GH-30006)
https://github.com/python/cpython/commit/b123ad8030a4ad15c8dbb7cb3638caf625943878


--

___
Python tracker 

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



[issue46016] fcntl module add F_DUP2FD_CLOEXEC

2021-12-09 Thread Kumar Aditya


Change by Kumar Aditya :


--
keywords: +patch
nosy: +kumaraditya303
nosy_count: 4.0 -> 5.0
pull_requests: +28230
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/30006

___
Python tracker 

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



[issue45999] Links to packaging broken

2021-12-09 Thread Ned Deily


Change by Ned Deily :


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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-09 Thread Dong-hee Na


Dong-hee Na  added the comment:

> If two strings are interned and part of the same interpreter, the "ptr1 == 
> ptr2" comparison continues to work.

Yeah, AFAIK Comparing two interned strings from different interpreters are not 
the available use-case.

--

___
Python tracker 

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



[issue45999] Links to packaging broken

2021-12-09 Thread Douglas Wright


Douglas Wright  added the comment:

The links are working now.

I recall that all of the links in that section pointed to different URLs on 3.9 
and newer than they did on 3.8.  On 3.9 and newer, you would land on "page not 
found" on readthedocs.org.

They all seem to match up now though.

--
status: pending -> open

___
Python tracker 

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



[issue28276] test_loading.py - false positive result for "def test_find" when find_library() is not functional or the (shared) library does not exist

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


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



[issue46025] Raising in an atexit function in dev mode crashes

2021-12-09 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +28229
pull_request: https://github.com/python/cpython/pull/30005

___
Python tracker 

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



[issue46025] Raising in an atexit function in dev mode crashes

2021-12-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset f0d290d25cad66e615ada68ba190b8a23ac1deaa by Pablo Galindo Salgado 
in branch 'main':
bpo-46025: Fix a crash in the atexit module for auto-unregistering functions 
(GH-30002)
https://github.com/python/cpython/commit/f0d290d25cad66e615ada68ba190b8a23ac1deaa


--

___
Python tracker 

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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-09 Thread Gabriele N Tornetta


Gabriele N Tornetta  added the comment:

The following example shows isinstance causing a side effect


class Side:

class Effect(Exception):
pass

def __getattribute__(self, name):
raise Side.Effect()


isinstance(Side(), str)


I'd be inclined to see this as a bug as I wouldn't expect isinstance to cause 
any side effects.

--
nosy: +Gabriele Tornetta

___
Python tracker 

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



[issue12142] Reference cycle when importing ctypes

2021-12-09 Thread Eryk Sun


Eryk Sun  added the comment:

The _ctypes extension module could have a dict that maps each format code to 
its (size, alignment), based on `formattable`. Then direct size comparisons 
wouldn't be limited to types defined by the struct module, and it wouldn't be 
necessary to create c_longdouble just to check its size and throw it away.

--
nosy: +eryksun

___
Python tracker 

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



[issue45391] 3.10 objects.inv classifies many types as data

2021-12-09 Thread Ken Jin


Ken Jin  added the comment:

As a start, I merged the types.UnionType fix because it's straightforward, but 
the rest are a little dubious so I'll leave this issue open for now.

--
title: 3.10 objects.inv classifies UnionType as data -> 3.10 objects.inv 
classifies many types as data

___
Python tracker 

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



[issue45391] 3.10 objects.inv classifies UnionType as data

2021-12-09 Thread miss-islington


miss-islington  added the comment:


New changeset 2c2ee83c4db4dbd54017dc364bbefc70fa75ea5d by Miss Islington (bot) 
in branch '3.10':
bpo-45391: mark UnionType as a class in documentation (GH-28757)
https://github.com/python/cpython/commit/2c2ee83c4db4dbd54017dc364bbefc70fa75ea5d


--

___
Python tracker 

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



[issue25066] Better repr for multiprocessing.synchronize objects

2021-12-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset af6b4068859a5d0c8afd696f3c0c0155660211a4 by Kumar Aditya in 
branch 'main':
bpo-25066: Added repr for multiprocessing.Event (GH-29749)
https://github.com/python/cpython/commit/af6b4068859a5d0c8afd696f3c0c0155660211a4


--
nosy: +pablogsal

___
Python tracker 

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



[issue45359] TopologicalSorter is not Generic at runtime (but is in typeshed)

2021-12-09 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

`if TYPE_CHECKING:` is a good choice, it works fine just now.
`from __future__ import annotations` is another alternative.

I don't see a reason for REMOVING already existing and correct annotations from 
typeshed.

--

___
Python tracker 

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



[issue46020] Optimize long_pow for the common case

2021-12-09 Thread Ken Jin


Ken Jin  added the comment:

I'm not sure about the original 10:1 difference in 3.10, but in 3.11, the 2:1 
difference might be due to the PEP 659 machinery optimizing for int * int, and 
float * float cases (see BINARY_OP_MULTIPLY_INT and BINARY_OP_MULTIPLY_FLOAT in 
ceval).

Last I recall, these were slightly faster than their unspecialized counterparts 
as they have less overhead in C function calls. Meanwhile, none of the power 
operations are optimized via PEP 659 machinery at the moment.

--
nosy: +kj

___
Python tracker 

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



[issue45391] 3.10 objects.inv classifies UnionType as data

2021-12-09 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue45391] 3.10 objects.inv classifies UnionType as data

2021-12-09 Thread Ken Jin

Ken Jin  added the comment:


New changeset e2cfc89e099b8fad5d8d5bd7f59dadffb6078778 by Bernát Gábor in 
branch 'main':
bpo-45391: mark UnionType as a class in documentation (GH-28757)
https://github.com/python/cpython/commit/e2cfc89e099b8fad5d8d5bd7f59dadffb6078778


--
nosy: +kj

___
Python tracker 

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



[issue15673] PEP 3121, 384 Refactoring applied to testcapi module

2021-12-09 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

The _testcapi modules should stay as it is, ref. msg384272 on bpo-40077:

Yes, please keep _testcapimodule.c as it is. Static types are still 
supported and need to be tested.

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



[issue23104] [Windows x86-64] ctypes: Incorrect function call

2021-12-09 Thread Eryk Sun


Change by Eryk Sun :


--
type:  -> behavior

___
Python tracker 

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



[issue23104] [Windows x86-64] ctypes: Incorrect function call

2021-12-09 Thread Eryk Sun


Eryk Sun  added the comment:

Victor's comment wasn't relevant. objid() stays referenced during the call.  
Anyway, I just built testlib.c and verified that this ctypes example works 
correctly in both 64-bit 3.4.4 and 3.10, so the issue is out of date.

--
nosy: +eryksun
resolution:  -> out of date

___
Python tracker 

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



[issue23104] [Windows x86-64] ctypes: Incorrect function call

2021-12-09 Thread Irit Katriel


Irit Katriel  added the comment:

I'm closing as there was no reply to Victor's suggestion and this is 7 years 
old. Please create a new issue if you are still having a problem with this in a 
supported python version (>= 3.9).

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



[issue12142] Reference cycle when importing ctypes

2021-12-09 Thread Irit Katriel


Irit Katriel  added the comment:

Looks like the long double issue is still there in 3.11

>>> import gc
>>> gc.set_debug(gc.DEBUG_LEAK)
>>> import ctypes
gc: collectable 
gc: collectable 
gc: collectable 
gc: collectable 
gc: collectable 
gc: collectable 
gc: collectable 
gc: collectable 
gc: collectable <_ctypes.PyCSimpleType 0x026417AE4E10>
gc: collectable 
gc: collectable 
gc: collectable 
gc: collectable 
>>> gc.garbage
[, (,), {'__module__': 
'types', '_m': , '__dict__': , '__weakref__': , '__doc__': None}, , (, ), , , (,), , (, , , ), 
, , {'__module__': 'ctypes', '_type_': 'g', '__dict__': 
, '__weakref__': , '__doc__': None}]

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.3

___
Python tracker 

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



[issue45359] TopologicalSorter is not Generic at runtime (but is in typeshed)

2021-12-09 Thread Jacob Hayes


Jacob Hayes  added the comment:

Thanks for merging!

Should typeshed be updated for <3.11 in the meantime or do you suggest `if 
TYPE_CHECKING` blocks on user side? Perhaps it's a non-issue if no one else has 
noticed this. :)

--

___
Python tracker 

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



[issue27062] `inspect` doesn't have `__all__`

2021-12-09 Thread Kumar Aditya


Change by Kumar Aditya :


--
keywords: +patch
nosy: +kumaraditya303
nosy_count: 2.0 -> 3.0
pull_requests: +28227
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30003

___
Python tracker 

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



[issue46025] Raising in an atexit function in dev mode crashes

2021-12-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue45359] TopologicalSorter is not Generic at runtime (but is in typeshed)

2021-12-09 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

The new feature is applied to Python 3.11 only

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 3.10, Python 3.9

___
Python tracker 

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



[issue46026] importlib.resources.read_text() raises FileNotFound

2021-12-09 Thread Zac Hatfield-Dodds


Zac Hatfield-Dodds  added the comment:

This may have appeared in the wild, via the backport, in

https://github.com/Nuitka/Nuitka/issues/1274 and
https://github.com/Nuitka/Nuitka/commit/ffe861cfe972c6bf19f9eea1ff95e35d0e4240b4

--

___
Python tracker 

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



[issue46025] Raising in an atexit function in dev mode crashes

2021-12-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +vstinner

___
Python tracker 

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



  1   2   >