[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



[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



[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


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



[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



[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



[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



[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



[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



[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



[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



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



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

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



[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



[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



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



[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



[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



[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



[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



[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



[issue45459] Limited API support for Py_buffer

2021-12-09 Thread Christian Heimes


Christian Heimes  added the comment:

> The C language sets other members to 0/NULL with this syntax, no?

No, they are not set to 0/NULL. 
https://en.wikipedia.org/wiki/Uninitialized_variable

--

___
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 Dennis Sweeney


Dennis Sweeney  added the comment:

I believe https://bugs.python.org/issue44376 added a special case for 2nd and 
3rd powers, and that's the 3.10/3.11 difference in the speed of x**2, not ceval 
optimizations.

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue34111] python-config breaks when symlinked to another location

2021-12-09 Thread Christian Heimes


Christian Heimes  added the comment:

Could you open a PR, please? The fix looks trivial.

--
components: +Build
nosy: +christian.heimes
stage:  -> needs patch
versions:  -Python 3.4, 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



[issue10850] inconsistent behavior concerning multiprocessing.manager.BaseManager._Server

2021-12-09 Thread Bar Harel


Bar Harel  added the comment:

It's technically not a bug as it is not exposed externally, but I concur with 
the OP that it shouldn't happen. I'll send a fix either way, and from there we 
will continue asking if _Server should be exposed or not.

--
nosy: +bar.harel
versions: +Python 3.10, Python 3.11, Python 3.8, Python 3.9 -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



[issue46018] expm1 may incorrectly raise OverflowError on underflow

2021-12-09 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

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

It's a bit cheap and nasty, but I think we could simply replace the line:

if (fabs(x) < 1.0)

in is_error with

if (fabs(x) < 2.0)

perhaps with an explanatory comment. All we need to do is distinguish underflow 
from overflow, and 2.0 is still clearly a _long_ way away from any overflow 
boundary.

It would be good to have a test that would trigger the behaviour, too.

--

___
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 presume this is also worth an upstream report? Setting ERANGE on a result 
that's close to -1.0 is rather questionable.

--

___
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 Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue45459] Limited API support for Py_buffer

2021-12-09 Thread STINNER Victor


STINNER Victor  added the comment:

Example:
---
struct Point { int x; int y; int z; };

int main()
{
struct Point p = {1};
return p.y;
}
---

gcc -O0 produces this machine code which sets p.y to 0 and p.z to 0:
---
Dump of assembler code for function main:
   0x00401106 <+0>: push   rbp
   0x00401107 <+1>: movrbp,rsp
   0x0040110a <+4>: movQWORD PTR [rbp-0xc],0x0
   0x00401112 <+12>:movDWORD PTR [rbp-0x4],0x0
   0x00401119 <+19>:movDWORD PTR [rbp-0xc],0x1
   0x00401120 <+26>:moveax,DWORD PTR [rbp-0x8]
   0x00401123 <+29>:poprbp
   0x00401124 <+30>:ret
---

gcc -O3 heavily optimize the code, it always return 0, it doesn't return a 
random value from the stack:
---
(gdb) disassemble main
Dump of assembler code for function main:
   0x00401020 <+0>: xoreax,eax
   0x00401022 <+2>: ret
---

The "C99 Standard 6.7.8.21" says:

If there are fewer initializers in a brace-enclosed list than there are 
elements or members of an aggregate, or fewer characters in a string literal 
used to initialize an array of known size than there are elements in the array, 
the remainder of the aggregate shall be initialized implicitly the same as 
objects that have static storage duration.

The C99 standard says that p.y and p.z must be set to 0.

I'm talking about the specific C syntax of a structure static initialization: 
"struct MyStruct x = {...};".


If "Py_buffer data = {NULL, NULL};" is allocated on the stack, all "data" 
Py_buffer members are set to 0 or NULL:

typedef struct bufferinfo {
void *buf;
PyObject *obj;/* owned reference */
Py_ssize_t len;
Py_ssize_t itemsize;  /* This is Py_ssize_t so it can be
 pointed to by strides in simple case.*/
int readonly;
int ndim;
char *format;
Py_ssize_t *shape;
Py_ssize_t *strides;
Py_ssize_t *suboffsets;
void *internal;
} Py_buffer;


If we want to add a version member to this structure, I would suggest to 
enforce the usage of a static initialization macro or an initialization 
function, like:
  "Py_buffer data; PyBuffer_Init(&data);"
or
  "Py_buffer data = PyBuffer_STATIC_INIT;"

The problem of the macro is that it is not usable on Python extensions was are 
not written in C or C++ (or more generally to extensions which cannot use 
macros).

--

A different approach is to use an API which allocates a Py_buffer on the heap 
memory, so if the structure becomes larger tomorrow, an old built C extensions 
continues to work:

Py_buffer *data = PyBuffer_New();
// ... use *data ...
PyBuffer_Free(data);

PyBuffer_New() can initialize the version member and allocates the proper 
memory block size.

The best is if the "... use *data ..." part is only done with function calls :-)

--

___
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 STINNER Victor


STINNER Victor  added the comment:

> We can not compare two Unicode by pointer even if both are interned 
> anymore... It was a nice optimization.

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

What is not compatible with subinterpreters, which have other interned string 
objects, is the assumption that two interned strings are not equal if both 
strings are interned and pointeres are not equal.

_PyUnicode_EqualToASCIIId() is the only function making this assumption.

* dictkeys_stringlookup(): if pointers are not equal, compare the hash: if the 
two hashes are equal, compare the strings content with unicode_eq()

* PyUnicode_Compare(): if pointers are not equal, compare the strings content 
with unicode_compare()

* _PyUnicode_EQ(): always compare the strings content

* PyUnicode_RichCompare(): if pointers are not equal, compare the strings 
content

None of these functions have a fast path for interned strings. Well, 
_PyUnicode_EqualToASCIIId() is different since right is always an interned 
string.


Note: unicode_compare() is strange, it requires both strings to be equal, but 
it does not consider that two strings are not equal if their kinds are not 
equal. If both strings are ready and their kinds are not equal, the two strings 
cannot be equal... unicode_compare_eq() returns 0 if the two kinds are not 
equal.

--

___
Python tracker 

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



[issue46007] [C API] PyUnicode_CHECK_INTERNED() doesn't work in the limited C API

2021-12-09 Thread miss-islington


miss-islington  added the comment:


New changeset 73325bbe774b16891f999fb557177206470676b1 by Victor Stinner in 
branch 'main':
bpo-46007: Exclude PyUnicode_CHECK_INTERNED() from limited C API (GH-29987)
https://github.com/python/cpython/commit/73325bbe774b16891f999fb557177206470676b1


--
nosy: +miss-islington

___
Python tracker 

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



[issue46007] [C API] PyUnicode_CHECK_INTERNED() doesn't work in the limited C API

2021-12-09 Thread STINNER Victor


Change by STINNER Victor :


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



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

2021-12-09 Thread Mark Dickinson


Mark Dickinson  added the comment:

@arhadthedev: Thanks for highlighting the issue.

> we need to check if the problem really has place and the PR needs to be 
> retracted until PyQt5 is ported to newer Python C API

I'm not particularly impressed by the arguments from cculianu. This was the 
right change to make: this is very general machinery, and we've seen many real 
issues over the years resulting from implicit acceptance of floats or Decimal 
objects where an integer is expected. 

It may well be that for some *specific* libraries like PyQt5 it makes sense to 
make a different choice. And indeed, PySide6 has done exactly that:

Python 3.10.0 (default, Nov 12 2021, 12:32:57) [Clang 12.0.5 
(clang-1205.0.22.11)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PySide6.QtCore import QPoint
>>> QPoint(2, 3)
PySide6.QtCore.QPoint(2, 3)
>>> QPoint(2.1, 3.3)
PySide6.QtCore.QPoint(2, 3)

So no, I don't believe this change should be reverted. At best, we could 
re-introduce the deprecation warnings and delay the full implementation of the 
change. But the deprecation warnings were present since Python 3.8, and so 
either the PyQt5 developers noticed them but didn't want to make the change, or 
didn't notice them. Either way, it's difficult to see what difference extending 
the deprecation warning period would make. Moreover, the new behaviour is 
already released, in Python 3.10.0 and 3.10.1, and the code churn would likely 
be more annoying than helpful.

I would suggest to cculianu that they take this up with the PyQt5 developers.

--

___
Python tracker 

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



[issue46021] fcntl module update supports FreeBSD F_KINFO flag

2021-12-09 Thread David CARLIER


New submission from David CARLIER :

- Enabling new F_KINFO flag.
- Returning a subset of practical data from it.

--
components: FreeBSD
messages: 408088
nosy: devnexen, koobs
priority: normal
pull_requests: 28224
severity: normal
status: open
title: fcntl module update supports FreeBSD F_KINFO flag

___
Python tracker 

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



[issue45459] Limited API support for Py_buffer

2021-12-09 Thread Christian Heimes


Christian Heimes  added the comment:

Thanks for the investigation. I didn't know about C99 Standard 6.7.8.21. That's 
a useful and sensible extension to the language.

In my opinion it is neither useful to extend the Py_buffer struct with a 
version tag nor to force users to allocate the struct on the heap. The current 
design has worked for over 13 years. Any deviation from the established design 
poses a risk to break 3rd party software.

I could be convinced to add PyBuffer_New() and PyBuffer_Free() as additional 
feature, but their use should be optional. The function were part of my first 
PR GH-29035.

--

___
Python tracker 

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



[issue46022] Multiprocessing.Server.serve_forever runs sys.exit()

2021-12-09 Thread Bar Harel


New submission from Bar Harel :

The Python docs recommends using `.serve_forever()` for running a 
multiprocessing manager.

The problem is, that unlike any equivalent `.serve_forever()`, this specific 
one calls `sys.exit()` and exits the program. This in turn may cause issues if 
that's not the only use of the Python program, as seen here:
https://stackoverflow.com/questions/70284538/overriding-a-built-in-class-method-that-another-class-i-want-to-inherit-from-rel

3 possible solutions:

1. Remove `sys.exit()`: This will cause `shutdown()` to not actually shut down. 
The function counts on the `.accepter()` daemon thread to close, but if other 
code is preventing that process from closing, it will continue uninterrupted.

2. Remove `sys.exit()` and check the `stop_event` inside the `.accepter()` 
daemon thread: This will only partially shut down. The socket will still listen 
and will only close when the listener receives a command. An option to solve it 
would be to dispatch a shutdown command, or close the Listener forcibly using 
`.close()`. All in all, I believe this is the best option.

3. Discourage the use of `serve_forever()`: Right now the way it looks, server 
is not implemented too well. Its `serve_forever()` function is endorsed by the 
docs, but the class itself is completely undocumented, with no documentation on 
any of its functions, and it shuts down the process calling the function when 
it finishes which is dubious at best. There are plenty more issues scattered 
around the bug tracker, one of them about its finalization due to the use of 
daemon threads. Everything can be implemented using start() together with an 
event. The only reason I don't like this option, is because `serve_forever()` 
does seem convenient and can be fixed per option 2.

I'll start implementing option 2 in the background, together with adding 
documentation, but I would enjoy gathering more feedback.

--
messages: 408090
nosy: bar.harel, davin, pitrou
priority: normal
severity: normal
status: open
title: Multiprocessing.Server.serve_forever runs sys.exit()
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



[issue46023] Modules/makesetup generated rules ignore *disabled*

2021-12-09 Thread Christian Heimes


New submission from Christian Heimes :

Modules/Setup can disable a module. However makesetup does not take *disabled* 
into account when it generated Makefile.

Example:

---Modules/Setup.local

*disabled*
pwd
---

makesetup generates a Makefile with "pwd" in MODDISABLED_NAMES and 
MODBUILT_NAMES. Because "pwd" is in MODBUILT_NAMES the module is built and 
included in python binary.

Expected result:
"pwd" module should not be built.

--
components: Build
messages: 408091
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: Modules/makesetup generated rules ignore *disabled*
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



[issue46023] Modules/makesetup generated rules ignore *disabled*

2021-12-09 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue46022] Multiprocessing.Server.serve_forever runs sys.exit()

2021-12-09 Thread Bar Harel


Bar Harel  added the comment:

Regarding backwards compatibility, the only issue that can arise from solutions 
1 or 2, is if someone uses a bare `except` statement for finalization around 
`serve_forever` instead of using `finally`.

Keep in mind the function is not documented and there is no good solution for 
the breakage as you're generally not supposed to catch SystemExit either way. 
We can make a small search for open source usage of `serve_forever` and see if 
catching SystemExit is a common idiom. Even if it's common, I still believe 
this breakage is acceptable.

--

___
Python tracker 

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



[issue46021] fcntl module update supports FreeBSD F_KINFO flag

2021-12-09 Thread Christian Heimes


Christian Heimes  added the comment:

Please update the ticket with more information

- What does the flag F_KINFO do?
- Which platforms support the F_KINFO flag?
- link to a man page or platform documentation

A ticket should contain enough information so that a reviewer can understand 
the purpose of a feature request.

--
nosy: +christian.heimes

___
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 Raymond Hettinger


Raymond Hettinger  added the comment:

Hmm, I had just looked at that code and it wasn't at all obvious that an 
optimization had been added.  I expected something like:

   if (exp==2) return PyNumber_Multiply(x, x);

I wonder where the extra clock cycles are going.  Looking at the ceval.c 
dispatch and the bodies of PyNumber_Multiply(), _PyNumber_PowerNoMod(), and 
PyNumber_Power(), it looks like the power dispatch code should be about the 
same as or slightly cheaper than the multiply dispatch.

I'm surprised there is still almost a two to one speed difference.   ISTM there 
is still too much overhead for squaring.

--

___
Python tracker 

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



[issue32917] ConfigParser writes a superfluous final blank line

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


--
stage: patch review -> resolved
status: pending -> closed

___
Python tracker 

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



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

This issue was closed more than 2.5 years ago. The changes were made in 3.8, 
not in 3.10. BTW, 3.8 only accepts security fixes now. Please open a new issue 
for new discussion.

--

___
Python tracker 

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



[issue46021] fcntl module update supports FreeBSD F_KINFO flag

2021-12-09 Thread David CARLIER


David CARLIER  added the comment:

- The F_KINFO flag returns the related kinfo_file from the file descriptor.
- While F_KINFO is, at the moment, FreeBSD's specific however other BSD has 
kinfo_file data as well thus the possibility they support a similar feature 
(F_KINFO appears only around the 5th of December).
- Does not appear yet on the man page most likely due to its very recent 
appareance.

--

___
Python tracker 

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



[issue46021] fcntl module update supports FreeBSD F_KINFO flag

2021-12-09 Thread David CARLIER


David CARLIER  added the comment:

- Got clues mostly from source code and header 
https://github.com/freebsd/freebsd-src/blob/794d3e8e63f4a6ebc8926030b6c937109ddc5485/sys/sys/fcntl.h#L273

--

___
Python tracker 

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



[issue38145] Fix short option 'd' in 'distutils' command 'bdist_dumb'

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



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

2021-12-09 Thread Mark Dickinson


Mark Dickinson  added the comment:

For the record, #37999 is the issue that turned the deprecation warnings into 
errors for Python 3.10. (But as Serhiy says, please open a new issue, or start 
a discussion on one of the mailing lists.)

--

___
Python tracker 

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



[issue15082] [httplib] httplib.BadStatusLine on any HTTPS connection in certain unknown cases.

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


--
stage: test needed -> resolved
status: pending -> closed

___
Python tracker 

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



[issue46020] Optimize long_pow for the common case

2021-12-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The situation for floats is also disappointing:

$ python3.11 -m timeit -s 'x=1.1' 'x ** 2'
500 loops, best of 5: 60.8 nsec per loop
$ python3.11 -m timeit -s 'x=1.1' 'x ** 2.0'
500 loops, best of 5: 51.5 nsec per loop
$ python3.11 -m timeit -s 'x=1.1' 'x * x'
2000 loops, best of 5: 17.7 nsec per loop

Complex numbers are more balanced.  Surprisingly, some of the complex cases are 
faster than their float counterparts:

$ python3.11 -m timeit -s 'x=1.1+2.2j' 'x ** 2'
500 loops, best of 5: 42.4 nsec per loop
$ python3.11 -m timeit -s 'x=1.1+2.2j' 'x ** 2.0'
500 loops, best of 5: 43.3 nsec per loop
$ python3.11 -m timeit -s 'x=1.1+2.2j' 'x ** 2.0j'
200 loops, best of 5: 107 nsec per loop
$ python3.11 -m timeit -s 'x=1.1+2.2j' 'x * x'
1000 loops, best of 5: 30.6 nsec per loop

Decimal still shows a large difference:

$ python3.11 -m timeit -s 'from decimal import Decimal' -s 'x=Decimal("1.1")' 
'x ** 2'
100 loops, best of 5: 206 nsec per loop
$ python3.11 -m timeit -s 'from decimal import Decimal' -s 'x=Decimal("1.1")' 
'x ** Decimal(2)'
100 loops, best of 5: 281 nsec per loop
$ python3.11 -m timeit -s 'from decimal import Decimal' -s 'x=Decimal("1.1")' 
'x * x'
500 loops, best of 5: 60.9 nsec per loop

--

___
Python tracker 

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



[issue10336] test_xmlrpc fails if gzip is not supported by client

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


--
stage: test needed -> resolved
status: pending -> closed

___
Python tracker 

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



[issue46022] Multiprocessing.Server.serve_forever runs sys.exit()

2021-12-09 Thread Bar Harel


Change by Bar Harel :


--
components: +Library (Lib)
type:  -> behavior

___
Python tracker 

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



[issue46021] fcntl module update supports FreeBSD F_KINFO flag

2021-12-09 Thread Christian Heimes


Christian Heimes  added the comment:

I still have no clue what the flag is doing. Could you please describe the 
purpose and meaning of kinfo_file so that somebody without FreeBSD Kernel 
insight can understand it? Much appreciated.

The feature is not available in FreeBSD 13.0. Is it scheduled for 14.0? We 
typically do not wrap new Kernel or OS features until they are available in 
stable OS releases.

--

___
Python tracker 

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



[issue1295179] termios.c in qnx4.25

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


--
stage: test needed -> resolved
status: pending -> closed

___
Python tracker 

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



[issue39694] Incorrect dictionary unpacking when calling str.format

2021-12-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I disagree, but does not insists if other core developers have other opinion.

This is a special case which breaks the rules. The Python language 
specification does not support non-string keywords. You cannot implement this 
"feature" in Python. And it is not compatible with other implementations (PyPy):

 ''.format(**{1:2})
Traceback (most recent call last):
  File "", line 1, in 
TypeError: format() keywords must be strings, not 'int'

It would be understandable to not enforce this limitation if it has significant 
costs. But in this case it costs almost nothing.

--

___
Python tracker 

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



[issue46021] fcntl module update supports FreeBSD F_KINFO flag

2021-12-09 Thread David CARLIER


David CARLIER  added the comment:

Ah right then no point then if there is no support for upcoming feature, indeed 
it s only FreeBSD 14 scheduled next year :-)

--

___
Python tracker 

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



[issue46021] fcntl module update supports FreeBSD F_KINFO flag

2021-12-09 Thread David CARLIER


David CARLIER  added the comment:

- A kinfo_file data holds file information from the kernel's perspective  (like 
the path or the current offset), more info here 
https://github.com/freebsd/freebsd-src/blob/main/sys/sys/user.h#L342

--

___
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 flvn.dev

New submission from flvn.dev :

Given the this directory structure:

```
logs
├── 2020
│  ├── 2020101.zip
|  ├── ...
├── 2021
│  ├── 2021101.zip
|  ├── ...
```

The following piece of code:

```python
from pathlib import Path
from zipfile import Path as ZipPath

for item in Path("logs").iterdir():
if item.is_dir():
path = next(item.iterdir())
print(ZipPath(path).name)

```

gives different results between Python 3.9.7 (empty strings) and 3.10.0 (the 
zip files name)

--
messages: 408104
nosy: flvn.dev
priority: normal
severity: normal
status: open
title: Different behaviour with zipfile
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



[issue46016] fcntl module add F_DUP2FD_CLOEXEC

2021-12-09 Thread Christian Heimes


Christian Heimes  added the comment:

GH-29993 broke docs:

python tools/rstlint.py -i tools -i ./venv -i README.rst
[2] whatsnew/3.11.rst:335: default role used
1 problem with severity 2 found.
make: *** [Makefile:216: check] Error 1

--
nosy: +christian.heimes
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open

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


--
assignee:  -> vstinner
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



[issue10048] urllib.request documentation confusing

2021-12-09 Thread Irit Katriel


Change by Irit Katriel :


--
stage: needs patch -> resolved
status: pending -> closed

___
Python tracker 

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



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

2021-12-09 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

Issue found by Matt Wozniski:

Running this with python3.10 -X dev segfaults:

import atexit
def func():
atexit.unregister(func)
1/0
atexit.register(func)

--
keywords: 3.10regression, 3.11regression
messages: 408106
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Raising in an atexit function in dev mode crashes
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



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

2021-12-09 Thread Zac Hatfield-Dodds


New submission from Zac Hatfield-Dodds :

Testing Hypothesis with Python 3.11.0a3, I've triggered a frustrating 
regression in importlib.resources:


# Both work in Python 3.9 and 3.10, but both fail in 3.11.0a3
from importlib.resources import files, read_text
read_text("hypothesis.vendor", "tlds-alpha-by-domain.txt")
files("hypothesis.vendor").joinpath("tlds-alpha-by-domain.txt").read_text()


Traceback (most recent call last):
  ...
  File "example.py", line 4, in 
read_text("hypothesis.vendor", "tlds-alpha-by-domain.txt")
^^
  File "python3.11/importlib/_legacy.py", line 25, in wrapper
return func(*args, **kwargs)
   ^
  File "python3.11/importlib/_legacy.py", line 67, in read_text
with open_text(package, resource, encoding, errors) as fp:
 ^^
  File "python3.11/importlib/_legacy.py", line 25, in wrapper
return func(*args, **kwargs)
   ^
  File "python3.11/importlib/_legacy.py", line 50, in open_text
return (_common.files(package) / _common.normalize_path(resource)).open(
   ^
  File "python3.11/importlib/_adapters.py", line 141, in open
raise FileNotFoundError("Can't open orphan path")
^
FileNotFoundError: Can't open orphan path


At first I thought this was just a problem with the _legacy shims, but since it 
also affects the new files() API it might be more serious.

--
components: Library (Lib)
messages: 408107
nosy: Zac Hatfield-Dodds, barry
priority: normal
severity: normal
status: open
title: importlib.resources.read_text() raises FileNotFound
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



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

2021-12-09 Thread Zac Hatfield-Dodds


Change by Zac Hatfield-Dodds :


--
nosy: +brett.cannon, jaraco

___
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



[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



[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



[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



[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



[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



[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



[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



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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



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



[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



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



[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



[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



[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



[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



  1   2   >