[issue46407] optimizing `1 << n` or `2 ** n` and modulo-only operations

2022-01-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +mark.dickinson, rhettinger, stutzbach, tim.peters

___
Python tracker 

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-17 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +kumaraditya303

___
Python tracker 

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



[issue46408] signal module wrongly relies on small int singletons

2022-01-17 Thread Christian Heimes


New submission from Christian Heimes :

The signal.signal() function directly compares PyObject *handler with PyObject 
*modstate->ignore_handler. This works on most platforms because they are both 
small ints and Python uses singletons for cached small ints.

The assumption breaks when Python is built without small int cache or a 
platform has SIG_IGN / SIG_DFL that is outside the range of small int cache. 
The wasm32-emscripten platform uses "((void (*)(int))-2)" (4294967294) for 
SIG_IGN. The wrong comparison breaks several tests on WASM32. The function 
should use PyObject_RichCompareBool(handler, modstate->ignore_handler, Py_EQ) 
instead.

if (handler == modstate->ignore_handler) {
func = SIG_IGN;
}
else if (handler == modstate->default_handler) {
func = SIG_DFL;
}

https://github.com/python/cpython/blob/7f4b69b9076bdbcea31f6ad16eb125ee99cf0175/Modules/signalmodule.c#L530-L534

--
components: Extension Modules
messages: 410747
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: signal module wrongly relies on small int singletons
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



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

2022-01-17 Thread Christian Heimes


Change by Christian Heimes :


--
dependencies: +signal module wrongly relies on small int singletons

___
Python tracker 

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



[issue46408] signal module wrongly relies on small int singletons

2022-01-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See msg234768 and issue23325. I propose to close this as a duplicate of 
issue23325.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue46407] optimizing `1 << n` or `2 ** n` and modulo-only operations

2022-01-17 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Another option to consider would be a table lookup of a pre-computed table of 
[1 << i for i in range(64)].

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue46408] signal module wrongly relies on small int singletons

2022-01-17 Thread Christian Heimes


Change by Christian Heimes :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Turn SIG_DFL and SIG_IGN into functions

___
Python tracker 

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



[issue46408] signal module wrongly relies on small int singletons

2022-01-17 Thread Christian Heimes


Christian Heimes  added the comment:

Yes, it's a duplicate.

--

___
Python tracker 

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



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

2022-01-17 Thread Christian Heimes


Change by Christian Heimes :


--
dependencies: +Turn SIG_DFL and SIG_IGN into functions

___
Python tracker 

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-17 Thread Kumar Aditya


Change by Kumar Aditya :


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

___
Python tracker 

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



[issue46393] Generate frozenset constants when explicitly appropriate

2022-01-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

As Steven have noted the compiler-time optimization is not applicable here 
because name frozenset is resolved at run-time.

In these cases where a set of constants can be replaced with a frozenset of 
constants (in "x in {1,2,3}" and in "for x in {1,2,3}") the compiler does it.

And I don't think there is an issue which is worth changing the language. 
Creating a frozenset of constants is pretty rare, and it is even more rare in 
tight loops. The most common cases (which are pretty rare anyway) are already 
covered.

--

___
Python tracker 

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-17 Thread Kumar Aditya


Kumar Aditya  added the comment:

I would like to work on this.

--

___
Python tracker 

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-17 Thread Kumar Aditya


Change by Kumar Aditya :


--
pull_requests: +28833
pull_request: https://github.com/python/cpython/pull/30630

___
Python tracker 

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-17 Thread Alex Waygood

Alex Waygood  added the comment:

Thanks, Kumar — I appreciate it!

> (Though since this can only work for 3.11+, maybe typeshed could also be 
> adjusted? For that you’d have to file a bug there.)

Yes — it's unfortunate, but I have some ideas for hacky workarounds we can 
implement in typeshed for 3.10 :) and, as you say — that's a problem to be 
dealt with on the typeshed issue tracker rather than here.

--

___
Python tracker 

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-17 Thread Alex Waygood


Alex Waygood  added the comment:

Do these changes warrant an entry in "What's New in 3.11"?

--

___
Python tracker 

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



[issue22039] PyObject_SetAttr doesn't mention value = NULL

2022-01-17 Thread Irit Katriel

Irit Katriel  added the comment:

I read the python-dev thread now and I see it was decided that it’s not worth 
removing it.

In recent versions of the doc it is mentioned that the function is in the 
stable ABI. Should we clarify exactly what is meant by ‘deprecated’?

--
status: pending -> open

___
Python tracker 

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



[issue44133] Some C-API symbols (e.g. Py_FrozenMain) are not always exported on Unix

2022-01-17 Thread Jakub Kulik


Jakub Kulik  added the comment:

>> On Solaris (and most likely several other platforms), 
>> `PyThread_get_thread_native_id` is also not available.

> Oh, I added an explicit test for that in my PR 30556.

Now it started failing on a different place:

==
FAIL: test_export_symbols (test.test_capi.CAPITest) 
(name='PyThread_get_thread_native_id')
--
Traceback (most recent call last):
  File "//cpython-main/Lib/test/test_capi.py", line 662, in 
test_export_symbols
self.assertTrue(hasattr(ctypes.pythonapi, name))

AssertionError: False is not true

Looking at the test, is the expectation that all OSes must implement it since 
3.11?

--

___
Python tracker 

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



[issue34135] The results of time.tzname print broken.

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



[issue46393] Generate frozenset constants when explicitly appropriate

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



[issue44133] Some C-API symbols (e.g. Py_FrozenMain) are not always exported on Unix

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

Oh no, I expected that the new way to build Python would also export 
PyThread_get_thread_native_id() on Solaris. I reopen the issue.

Can you please specify your configure command? Can you check without Python if 
the symbol is exported or not? If you use --enable-shared, check in libpython, 
otherwise check in the "python" binary.

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread Jakub Kulik


Jakub Kulik  added the comment:

This also broke our Solaris build with the following error:

==
FAIL: testGetaddrinfo (test.test_socket.GeneralModuleTests)
--
Traceback (most recent call last):
  File "//cpython-main/Lib/test/test_socket.py", line 1523, in 
testGetaddrinfo
self.assertEqual(repr(type), '')
^^^
AssertionError: '' != ''
- 
?  ^
+ 
?  ^

(test.test_socket.GeneralModuleTests fails with the same error).

The issue is almost certainly that on Solaris, SOCK_STREAM is defined as 2 
rather than 1; the following simple program confirms that:

#include 
#include 

void main() {
printf("%d\n", SOCK_STREAM);
}

I'm just not sure whether to fix this with `assertRegex` or a special branch 
for Solaris (though I am not sure whether everybody else uses 1 or it's more 
varied).

--
nosy: +kulikjak

___
Python tracker 

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



[issue24194] Make tokenize recognize Other_ID_Start and Other_ID_Continue chars

2022-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue13886] readline-related test_builtin failure

2022-01-17 Thread STINNER Victor

STINNER Victor  added the comment:

On Fedora 35, I still reproduce the initial issue on the main branch of Python:

$ ./python -E -m test -v test_readline test_builtin
(...)

==
FAIL: test_input_tty_non_ascii (test.test_builtin.PtyTests)
--
Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/test/test_builtin.py", line 2095, in 
test_input_tty_non_ascii
self.check_input_tty("prompté", b"quux\xe9", "utf-8")
^
  File "/home/vstinner/python/main/Lib/test/test_builtin.py", line 2086, in 
check_input_tty
self.assertEqual(input_result, expected)

AssertionError: 'quux' != 'quux\udce9'
- quux
+ quux\udce9
? +


==
FAIL: test_input_tty_non_ascii_unicode_errors (test.test_builtin.PtyTests)
--
Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/test/test_builtin.py", line 2099, in 
test_input_tty_non_ascii_unicode_errors
self.check_input_tty("prompté", b"quux\xe9", "ascii")
^
  File "/home/vstinner/python/main/Lib/test/test_builtin.py", line 2086, in 
check_input_tty
self.assertEqual(input_result, expected)

AssertionError: 'quux' != 'quux\udce9'
- quux
+ quux\udce9
? +
(...)


Fedora 35 uses readline 8.1:

$ ldd $(./python -c 'import readline; print(readline.__file__)')
...
libreadline.so.8 => /lib64/libreadline.so.8 (0x7fd00e553000)
...
$ rpm -qf /lib64/libreadline.so.8
readline-8.1-3.fc35.x86_64

$ make pythoninfo|grep readline
readline._READLINE_LIBRARY_VERSION: 8.1
readline._READLINE_RUNTIME_VERSION: 0x801
readline._READLINE_VERSION: 0x801

--

___
Python tracker 

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



[issue39064] ValueError in zipfile.ZipFile

2022-01-17 Thread jvoisin


jvoisin  added the comment:

Yes, I can reproduce it:

```
$ python3 --version
Python 3.9.9

$ python3.9 ziprepo.py 
./crash-4da08e9ababa495ac51ecad588fd61081a66b5bb6e7a0e791f44907fa274ec62 
Traceback (most recent call last):
  File "/home/jvoisin/Downloads/ziprepo.py", line 4, in 
zipfile.ZipFile(sys.argv[1])
  File "/usr/lib/python3.9/zipfile.py", line 1257, in __init__
self._RealGetContents()
  File "/usr/lib/python3.9/zipfile.py", line 1342, in _RealGetContents
fp.seek(self.start_dir, 0)
ValueError: cannot fit 'int' into an offset-sized integer
$
```

> It's unlikely that anyone will download a binary from bpo and open it. Can 
> you help us reproduce the issue without that?

The *binary* is a corrupted zip file to open with `zipfile.ZipFile()`, it can't 
be executed on its own.

--
status: pending -> open

___
Python tracker 

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



[issue13886] readline-related test_builtin failure

2022-01-17 Thread STINNER Victor

STINNER Victor  added the comment:

Oh, the test_builtin.test_input_tty_non_ascii() fails just if test_readline is 
loaded previously:

$ ./python -E -m test -m test.test_builtin.PtyTests.test_input_tty_non_ascii -v 
test_readline test_builtin
== CPython 3.11.0a4+ (heads/main:7f4b69b9076, Jan 17 2022, 12:28:15) [GCC 
11.2.1 20211203 (Red Hat 11.2.1-7)]
== Linux-5.15.12-200.fc35.x86_64-x86_64-with-glibc2.34 little-endian
== cwd: /home/vstinner/python/main/build/test_python_49429æ
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 0.48 Run tests sequentially
0:00:00 load avg: 0.48 [1/2] test_readline

--
Ran 0 tests in 0.000s

OK
0:00:00 load avg: 0.48 [2/2] test_builtin -- test_readline ran no tests
test_input_tty_non_ascii (test.test_builtin.PtyTests) ... FAIL

==
FAIL: test_input_tty_non_ascii (test.test_builtin.PtyTests)
--
Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/test/test_builtin.py", line 2095, in 
test_input_tty_non_ascii
self.check_input_tty("prompté", b"quux\xe9", "utf-8")
^
  File "/home/vstinner/python/main/Lib/test/test_builtin.py", line 2086, in 
check_input_tty
self.assertEqual(input_result, expected)

AssertionError: 'quux' != 'quux\udce9'
- quux
+ quux\udce9
? +


--
Ran 1 test in 0.013s

FAILED (failures=1)
test test_builtin failed
test_builtin failed (1 failure)

== Tests result: FAILURE ==

1 test failed:
test_builtin

1 test run no tests:
test_readline

Total duration: 559 ms
Tests result: FAILURE


In just, just importing readline is enough to make the test fails:

$ git diff Lib/test/test_builtin.py
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 6dc4fa55502..20d3d33d9fb 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -1,3 +1,5 @@
+import readline
+
 # Python test set -- built-in functions
 
 import ast


$ ./python -E -m test -m test.test_builtin.PtyTests.test_input_tty_non_ascii -v 
test_builtin
(...)

==
FAIL: test_input_tty_non_ascii (test.test_builtin.PtyTests)
--
Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/test/test_builtin.py", line 2097, in 
test_input_tty_non_ascii
self.check_input_tty("prompté", b"quux\xe9", "utf-8")
^
  File "/home/vstinner/python/main/Lib/test/test_builtin.py", line 2088, in 
check_input_tty
self.assertEqual(input_result, expected)

AssertionError: 'quux' != 'quux\udce9'
- quux
+ quux\udce9
? +

(...)

--

___
Python tracker 

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



[issue39064] ValueError in zipfile.ZipFile

2022-01-17 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.9 -Python 3.7

___
Python tracker 

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



[issue44133] Some C-API symbols (e.g. Py_FrozenMain) are not always exported on Unix

2022-01-17 Thread Jakub Kulik


Jakub Kulik  added the comment:

Ah, sorry, I could have described the issue better. It's not a problem with 
exporting, PyThread_get_thread_native_id() isn't available on Solaris (and 
possibly other platforms) at all.

https://github.com/python/cpython/blob/main/Include/pythread.h#L28
https://github.com/python/cpython/blob/main/Python/thread_pthread.h#L329

The reason I didn't implement it yet is that Solaris doesn't expose anything 
like native thread id. We do have functions like `_lwp_self()` or 
`pthread_self()` or `thr_self()` but neither of them returns id where "value 
may be used to uniquely identify this particular thread system-wide". (I 
presume that means that no other thread of no other process running on a given 
system would return the same number - all these functions return single digit 
numbers so there is no way they are unique system wide).

If necessary, I guess that such a number can be created by masking pid and 
thread id together, but then there's a question of how it is supposed to be 
used (because OS would not understand it).

--

___
Python tracker 

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



[issue46389] 3.11: unused generator comprehensions cause f_lineno==None

2022-01-17 Thread Mark Shannon


Mark Shannon  added the comment:

This has the same root cause as https://bugs.python.org/issue46374:
closing the unused generator expression exposes the generator's frame before it 
has been initialized.

--

___
Python tracker 

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



[issue46409] Add a new bytecode instruction to create generators

2022-01-17 Thread Mark Shannon


New submission from Mark Shannon :

(including coroutines, and async generators)

We now make the start and resumption of Python functions explicit in the 
bytecode which allows us to initialize frames in the bytecode without exposing 
incomplete frames tracing, the GC etc.
However, we still expose incomplete frames when creating generators.

By making the creation of generators explicit in the bytecode we first create 
the frame, then the generator and all is well.

See https://bugs.python.org/issue46374 and https://bugs.python.org/issue46389 
for examples.

--
assignee: Mark.Shannon
components: Interpreter Core
messages: 410764
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Add a new bytecode instruction to create generators
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



[issue46407] optimizing `1 << n` or `2 ** n` and modulo-only operations

2022-01-17 Thread theeshallnotknowethme


theeshallnotknowethme  added the comment:

> Another option to consider would be a table lookup of a pre-computed table of 
> [1 << i for i in range(64)].
Does it have a significantly better performance compared to not having a table 
lookup?

--

___
Python tracker 

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



[issue46390] Multiple test failures on Alpine 3.15 / musl-1.2.2-r7

2022-01-17 Thread Christian Heimes


Change by Christian Heimes :


Added file: https://bugs.python.org/file50566/alpine315-tests.txt

___
Python tracker 

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



[issue13886] readline-related test_builtin failure

2022-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28834
pull_request: https://github.com/python/cpython/pull/30631

___
Python tracker 

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



[issue13886] readline-related test_builtin failure

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

Since nobody managed to fix this issue in 10 years and the test still fails if 
the readline module is loaded, I wrote GH-30631 to skip the test if the 
readline module is loaded.

--

___
Python tracker 

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



[issue13886] test_builtin.PtyTests fail on non-ASCII characters if the readline module is loaded

2022-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
title: readline-related test_builtin failure -> test_builtin.PtyTests fail on 
non-ASCII characters if the readline module is loaded

___
Python tracker 

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



[issue13886] test_builtin.PtyTests fail on non-ASCII characters if the readline module is loaded

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

rl-locale.diff changes the readline implementation of the PyOS_Readline() to 
set LC_CTYPE locale to "C": setlocale(LC_CTYPE, "C"), rather to the user 
preferred locale: setlocale(LC_CTYPE, ""). IMO it's a bad idea. Python made 
great progress in Unicode support, readline has a good Unicode support, and in 
most cases, it just works like a charm. This change looks a hack just to get 
these 2 specific tests to pass, but it breaks any other usage of readline.

rl-test.diff skips the test if the readline module can be imported, and it 
always import the readline module. It's different than that GH-30631 which only 
checks if the readline module is currently imported: my change doesn't import 
readline in test_builtin.

"input-readline*.patch" patches and GH-7133 spawn a fresh Python process to 
make sure that the readline is not imported or to import readline explicitly. 
They are better than my fix, but they are more complicated. It seems likle 
these changes also fix test_input_tty_non_ascii() but I don't understand how.

--

___
Python tracker 

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



[issue46407] optimizing `1 << n` or `2 ** n` and modulo-only operations

2022-01-17 Thread theeshallnotknowethme


theeshallnotknowethme  added the comment:

Also how would it be implemented? in terms of a PyLongObject or just a uint64_t?

--

___
Python tracker 

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



[issue13888] test_builtin failure when run after test_tk

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

I cannot reproduce this issue on the Python main branch on Fedora 35 with Tk 
8.6.10 and libX11 1.7.3.1. I close the issue, please reopen it if you can still 
reproduce it.

One year ago, Serhiy wrote that the issue was still reproducible on Linux but 
he didn't mention the Tk and libX11 versions.

I used the command:

  ./python -Wd -E -bb -m test -vuall test_tk test_builtin

Versions:

$ make pythoninfo|grep ^tk
tkinter.TCL_VERSION: 8.6
tkinter.TK_VERSION: 8.6
tkinter.info_patchlevel: 8.6.10

$ rpm -q tk tcl libX11
tk-8.6.10-7.fc35.x86_64
tcl-8.6.10-6.fc35.x86_64
libX11-1.7.3.1-1.fc35.x86_64

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



[issue46410] TypeError when parsing regexp with unicode named character sequence escape

2022-01-17 Thread Jirka Marsik


New submission from Jirka Marsik :

re.compile(r"\N{name of Unicode Named Character Sequence}"), e.g. 
re.compile(r"\N{KEYCAP NUMBER SIGN}"), throws a TypeError. The regular 
expression parser relies on 'unicodedata' to lookup character names. The 
'unicodedata' module recently added support for Unicode Named Character 
Sequences (https://www.unicode.org/Public/13.0.0/ucd/NamedSequences.txt). 
Trying to use these named character sequences in a regular expression leads to 
a 'TypeError', as the regexp parser tries to call 'ord' on a string with length 
> 1.

--
components: Regular Expressions
messages: 410770
nosy: ezio.melotti, jirkamarsik, mrabarnett
priority: normal
severity: normal
status: open
title: TypeError when parsing regexp with unicode named character sequence 
escape
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



[issue41034] test_builtin: PtyTests fail when run twice

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

The "./python -m test -R 3:3 test_builtin" command loads the readline module 
somehow:
---
$ ./python -i -m test -R 3:3 test_builtin 
(...)
SystemExit: 0

>>> import sys
>>> 'readline' in sys.modules
True
---

This bug is a duplicate of bpo-13886. Moreover, I tested manually: my change 
GH-30631 fix this issue.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> test_builtin.PtyTests fail on non-ASCII characters if the 
readline module is loaded

___
Python tracker 

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



[issue13886] test_builtin.PtyTests fail on non-ASCII characters if the readline module is loaded

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-41034 "test_builtin: PtyTests fail when run twice" as a duplicate 
of this issue. Moreover, I tested manually: my change GH-30631 fix the 
"./python -m test -R 3:3 test_builtin" command.

--

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner
nosy_count: 14.0 -> 15.0
pull_requests: +28835
pull_request: https://github.com/python/cpython/pull/30632

___
Python tracker 

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



[issue46409] Add a new bytecode instruction to create generators

2022-01-17 Thread Mark Shannon


Change by Mark Shannon :


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

___
Python tracker 

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



[issue20271] urllib.parse.urlparse() accepts wrong URLs

2022-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 42a64c03ec5c443f2a5c2ee4284622f5d1f5326c by Victor Stinner in 
branch 'main':
Revert "bpo-40066:  [Enum] update str() and format() output (GH-30582)" 
(GH-30632)
https://github.com/python/cpython/commit/42a64c03ec5c443f2a5c2ee4284622f5d1f5326c


--

___
Python tracker 

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



[issue13886] test_builtin.PtyTests fail on non-ASCII characters if the readline module is loaded

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset ad6e640f910787e73fd00f59117fbd22cdf88c78 by Victor Stinner in 
branch 'main':
bpo-13886: Skip PTY non-ASCII tests if readline is loaded (GH-30631)
https://github.com/python/cpython/commit/ad6e640f910787e73fd00f59117fbd22cdf88c78


--

___
Python tracker 

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



[issue13886] test_builtin.PtyTests fail on non-ASCII characters if the readline module is loaded

2022-01-17 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 10.0 -> 11.0
pull_requests: +28837
pull_request: https://github.com/python/cpython/pull/30634

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

Sorry, I had to revert the change since it broke the CI and it prevented to 
merge new PRs. Tell me if I can help to get this test fixed and to get this 
change merged again.

By the way, the PR 30582 was merged even if the Docs CI failed.

--

___
Python tracker 

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



[issue13886] test_builtin.PtyTests fail on non-ASCII characters if the readline module is loaded

2022-01-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28838
pull_request: https://github.com/python/cpython/pull/30635

___
Python tracker 

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



[issue44133] Some C-API symbols (e.g. Py_FrozenMain) are not always exported on Unix

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

> Ah, sorry, I could have described the issue better. It's not a problem with 
> exporting, PyThread_get_thread_native_id() isn't available on Solaris (and 
> possibly other platforms) at all.

Oh ok, it's a simple bug in my test. I wrote GH-30636 to fix it.

--

___
Python tracker 

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



[issue44133] Some C-API symbols (e.g. Py_FrozenMain) are not always exported on Unix

2022-01-17 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue45444] test.test_concurrent_futures fail in x86_ 64 architecture

2022-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue13886] test_builtin.PtyTests fail on non-ASCII characters if the readline module is loaded

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

With my change, the two following commands now pass successfully:

* ./python -m test test_readline test_builtin 
* ./python -m test -R 3:3 test_builtin

--

___
Python tracker 

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



[issue45522] Allow to build Python without freelists

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue to not forget to complete the doc.

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



[issue46402] Enhance sqlite3 to avoid implicit creation?

2022-01-17 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

FYI, you can already do this using the URI option:

cx = sqlite3.connect("file:test.db?mode=rw", uri=True)

--

___
Python tracker 

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



[issue46402] Enhance sqlite3 to avoid implicit creation?

2022-01-17 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

See also bpo-24887.

--

___
Python tracker 

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



[issue46402] Enhance sqlite3 to avoid implicit creation?

2022-01-17 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

IMO, the URI "API" is not very pythonic; I have to look up the format every 
time I'm using it.

OTOH, introducing flags, or keywords, for every option will add a lot of code.

--

___
Python tracker 

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



[issue13886] test_builtin.PtyTests fail on non-ASCII characters if the readline module is loaded

2022-01-17 Thread miss-islington


miss-islington  added the comment:


New changeset 1345b460f568afa8a6f9c0e2b23adba5015f208e by Miss Islington (bot) 
in branch '3.10':
bpo-13886: Skip PTY non-ASCII tests if readline is loaded (GH-30631)
https://github.com/python/cpython/commit/1345b460f568afa8a6f9c0e2b23adba5015f208e


--

___
Python tracker 

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



[issue46402] Enhance sqlite3 to avoid implicit creation?

2022-01-17 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

OTOH, implementing an API similar to apsw (adding a flags keyword) would make 
it easier for users to switch between that and the stdlib sqlite3.

--

___
Python tracker 

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



[issue13886] test_builtin.PtyTests fail on non-ASCII characters if the readline module is loaded

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0fbb9afbddb93408e34bdb7625002374cb2ad68c by Miss Islington (bot) 
in branch '3.9':
bpo-13886: Skip PTY non-ASCII tests if readline is loaded (GH-30631) (GH-30635)
https://github.com/python/cpython/commit/0fbb9afbddb93408e34bdb7625002374cb2ad68c


--

___
Python tracker 

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



[issue46383] _zoneinfo module_free has invalid function signature

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7a822c92782ffda8fa32a4b30a95b9de7cc1b8e6 by Miss Islington (bot) 
in branch '3.10':
bpo-46383: Fix signature of zoneinfo module_free function (GH-30607) (GH-30610)
https://github.com/python/cpython/commit/7a822c92782ffda8fa32a4b30a95b9de7cc1b8e6


--
nosy: +vstinner

___
Python tracker 

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



[issue13886] test_builtin.PtyTests fail on non-ASCII characters if the readline module is loaded

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, the initial issue is now fixed: the test pass.

If someone wants to write test input() with non-ASCII input and readline, I 
suggest to open a new issue and add the test in the test_readline module 
instead.

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



[issue44133] Some C-API symbols (e.g. Py_FrozenMain) are not always exported on Unix

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 16901c0482734dbd389b09ca3edfcf3e22faeed7 by Victor Stinner in 
branch 'main':
bpo-44133: Skip PyThread_get_thread_native_id() if not available (GH-30636)
https://github.com/python/cpython/commit/16901c0482734dbd389b09ca3edfcf3e22faeed7


--

___
Python tracker 

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



[issue44133] Some C-API symbols (e.g. Py_FrozenMain) are not always exported on Unix

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



[issue38550] hashlib missing algorithms

2022-01-17 Thread Irit Katriel


Change by Irit Katriel :


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



[issue22039] PyObject_SetAttr doesn't mention value = NULL

2022-01-17 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +petr.viktorin

___
Python tracker 

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



[issue46389] 3.11: unused generator comprehensions cause f_lineno==None

2022-01-17 Thread Mark Shannon


Change by Mark Shannon :


--
assignee:  -> Mark.Shannon

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +kumaraditya303
nosy_count: 15.0 -> 16.0
pull_requests: +28840
pull_request: https://github.com/python/cpython/pull/30637

___
Python tracker 

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



[issue46374] Assertion failed in ceval.c

2022-01-17 Thread Mark Shannon


Change by Mark Shannon :


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



[issue22039] PyObject_SetAttr doesn't mention value = NULL

2022-01-17 Thread Petr Viktorin


Petr Viktorin  added the comment:

This cannot be changed in 3.x, since the PyObject_DelAttr macro calls 
PyObject_SetAttr(..., NULL), and the macro is expanded in all extensions that 
use the stable ABI.
(Technically, it would be possible to add a PyObject_SetAttr *macro* that would 
warn/fail, while keeping the PyObject_SetAttr *function* untouched, but that 
would be a pain to test/maintain.) 

The wording could be clarified to something like: "This behaviour is deprecated 
in favour of using PyObject_DelAttr(), but there are currently no plans to 
remove it."

--

___
Python tracker 

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



[issue46411] modernize exception handling in tests

2022-01-17 Thread Irit Katriel


New submission from Irit Katriel :

There are a few tests that use sys.exc_info() because they needed to in python 
2, but there is no longer a reason to do it. I will make a patch shortly.

--
assignee: iritkatriel
components: Tests
messages: 410789
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: modernize exception handling in tests
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue46411] modernize exception handling in tests

2022-01-17 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue46402] Enhance sqlite3 to avoid implicit creation?

2022-01-17 Thread Ned Batchelder


Ned Batchelder  added the comment:

@Erlend: thanks for the URI tip, I missed that as a possibility in the SQLite 
docs.

--

___
Python tracker 

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



[issue22039] PyObject_SetAttr doesn't mention value = NULL

2022-01-17 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue46412] PyQT6 projects crashes with python 3.10

2022-01-17 Thread Fernando Pérez Gómez

New submission from Fernando Pérez Gómez :

can't translate ui. files , flags of alignment , curve types of animation 
doesn´t wors ...etc

--
messages: 410791
nosy: fernandoprezgmez
priority: normal
severity: normal
status: open
title: PyQT6 projects crashes with python 3.10
type: crash
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



[issue46413] `__or__` is not covered for `_GenericAlias` and `_SpecialGenericAlias` in `typing`

2022-01-17 Thread Nikita Sobolev


New submission from Nikita Sobolev :

Today I've noticed that these two methods are not covered: 
https://github.com/python/cpython/blame/16901c0482734dbd389b09ca3edfcf3e22faeed7/Lib/typing.py#L1028-L1032

- `typing._GenericAlias.__or__`
- `typing._GenericAlias.__ror__`

Later, I've realized that these two methods are not covered as well: 
https://github.com/python/cpython/blame/16901c0482734dbd389b09ca3edfcf3e22faeed7/Lib/typing.py#L1149-L1153

- `typing._SpecialGenericAlias.__or__`
- `typing._SpecialGenericAlias.__ror__`

My test plan is:
1. Cover regular `_GenericAlias` with `|` operation
2. Cover some `_SpecialGeneriAlias` instances like `Sized` and `Hashable`
3. Cover `Callable` and `Tuple` types, because they are a special-cased 
subtypes of `_SpecialGeneriAlias`

PR is on its way.

--
components: Tests
messages: 410792
nosy: sobolevn
priority: normal
severity: normal
status: open
title: `__or__` is not covered for `_GenericAlias` and `_SpecialGenericAlias` 
in `typing`
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



[issue46413] `__or__` is not covered for `_GenericAlias` and `_SpecialGenericAlias` in `typing`

2022-01-17 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue46402] Enhance sqlite3 to avoid implicit creation?

2022-01-17 Thread Erlend E. Aasland

Erlend E. Aasland  added the comment:

I guess we could do more to promote that trick in the docs. It’s quite useful.

--

___
Python tracker 

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



[issue46412] PyQT6 projects crashes with python 3.10

2022-01-17 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

This is most likely a problem with PyQt6. Please ask that project first (with a 
clearer description of what goes wrong and on which platforms).

--
nosy: +ronaldoussoren
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue46414] Add typing.reveal_type

2022-01-17 Thread Jelle Zijlstra


New submission from Jelle Zijlstra :

The `reveal_type()` primitive is injected by type checkers into the builtins. 
When the type checker sees a call, it prints the inferred type of the argument.

This has been implemented across all type checkers, but adding an 
implementation to `typing` would help document the behavior and make it more 
discoverable for users. Also, it means code with `reveal_type()` calls can run 
without runtime errors, useful if you want to run your tests at the same time 
as you're debugging a typing issue.

The runtime implementation can be very simple:

def reveal_type(obj: _T, /) -> _T:
print("Runtime type is", type(obj))
return obj


reveal_type() is supported by all type checkers that I'm aware of (docs include 
https://google.github.io/pytype/faq.html#can-i-find-out-what-pytype-thinks-the-type-of-my-expression-is
 for pytype and 
https://mypy.readthedocs.io/en/stable/common_issues.html#reveal-type for mypy).

One area of divergence is the return value. Pyright returns the inferred type 
of the expression as a string (and uses that in its test suite for testing type 
inference). Mypy returns the argument, which has the advantage that you can 
insert `reveal_type()` in the middle of an expression without having to put it 
on its own line. Also, the Pyright behavior cannot sensibly be implemented at 
runtime. Therefore, I suggest using Mypy's behavior for `typing.reveal_type`.

--
assignee: Jelle Zijlstra
components: Library (Lib)
messages: 410794
nosy: AlexWaygood, Jelle Zijlstra, gvanrossum, kj
priority: normal
severity: normal
status: open
title: Add typing.reveal_type
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



[issue22039] PyObject_SetAttr doesn't mention value = NULL

2022-01-17 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.4, Python 
3.5

___
Python tracker 

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



[issue34875] Change .js mime to "text/javascript"

2022-01-17 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.6, Python 
3.7, Python 3.8

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread Ethan Furman


Ethan Furman  added the comment:

After merging in doc fix by kumaraditya303, I'll update tests so Solaris passes.

--

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 83d544b9292870eb44f6fca37df0aa351c4ef83a by Kumar Aditya in 
branch 'main':
bpo-40066: [Enum] skip failing doc test (GH-30637)
https://github.com/python/cpython/commit/83d544b9292870eb44f6fca37df0aa351c4ef83a


--

___
Python tracker 

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



[issue46415] ipaddress.ip_{address, network, interface} raise TypeError instead of ValueError if given a tuple as address

2022-01-17 Thread Thomas Cellerier


New submission from Thomas Cellerier :

`IPv*Network` and `IPv*Interface` constructors accept a 2-tuple of (address 
description, netmask) as the address parameter.
When the tuple-based address is used errors are not propagated correctly 
through the `ipaddress.ip_*` helper because of the %-formatting now expecting 
several arguments:

In [7]: ipaddress.ip_network(("192.168.100.0", "fooo"))

---
TypeError Traceback (most recent call 
last)
 in 
> 1 ipaddress.ip_network(("192.168.100.0", "fooo"))

/usr/lib/python3.8/ipaddress.py in ip_network(address, strict)
 81 pass
 82
---> 83 raise ValueError('%r does not appear to be an IPv4 or IPv6 
network' %
 84  address)
 85

TypeError: not all arguments converted during string formatting

Compared to:

In [8]: ipaddress.IPv4Network(("192.168.100.0", "foo"))

---
NetmaskValueError Traceback (most recent call 
last)
 in 
> 1 ipaddress.IPv4Network(("192.168.100.0", "foo"))

/usr/lib/python3.8/ipaddress.py in __init__(self, address, strict)
   1453
   1454 self.network_address = IPv4Address(addr)
-> 1455 self.netmask, self._prefixlen = self._make_netmask(mask)
   1456 packed = int(self.network_address)
   1457 if packed & int(self.netmask) != packed:

/usr/lib/python3.8/ipaddress.py in _make_netmask(cls, arg)
   1118 # Check for a netmask or hostmask in 
dotted-quad form.
   1119 # This may raise NetmaskValueError.
-> 1120 prefixlen = cls._prefix_from_ip_string(arg)
   1121 netmask = 
IPv4Address(cls._ip_int_from_prefix(prefixlen))
   1122 cls._netmask_cache[arg] = netmask, prefixlen

/usr/lib/python3.8/ipaddress.py in _prefix_from_ip_string(cls, ip_str)
516 ip_int = cls._ip_int_from_string(ip_str)
517 except AddressValueError:
--> 518 cls._report_invalid_netmask(ip_str)
519
520 # Try matching a netmask (this would be /1*0*/ as a 
bitwise regexp).

/usr/lib/python3.8/ipaddress.py in _report_invalid_netmask(cls, 
netmask_str)
472 def _report_invalid_netmask(cls, netmask_str):
473 msg = '%r is not a valid netmask' % netmask_str
--> 474 raise NetmaskValueError(msg) from None
475
476 @classmethod

NetmaskValueError: 'foo' is not a valid netmask

--
components: Library (Lib)
messages: 410798
nosy: thomascellerier
priority: normal
severity: normal
status: open
title: ipaddress.ip_{address,network,interface} raise TypeError instead of 
ValueError if given a tuple as address
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue46381] Improve documentation of CFLAGS_NODIST, LDFLAGS_NODIST

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

Do you want to propose a PR?

--
nosy: +vstinner

___
Python tracker 

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



[issue46416] Direct invocation of `Lib/test/test_typing.py` fails

2022-01-17 Thread Nikita Sobolev

New submission from Nikita Sobolev :

Here's the problem:

```
» ./python.exe Lib/test/test_typing.py
s.F.
==
FAIL: test_special_attrs2 (__main__.SpecialAttrsTests)
--
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/Lib/test/test_typing.py", line 5068, in 
test_special_attrs2
self.assertEqual(
^
AssertionError: '__main__' != 'test.test_typing'
- __main__
+ test.test_typing
```

I think it is a good idea to use the same hack we have in `test_enum.py`: 
https://github.com/python/cpython/blob/83d544b9292870eb44f6fca37df0aa351c4ef83a/Lib/test/test_enum.py#L34

```python
MODULE = ('test.test_typing', '__main__')[__name__=='__main__']
```

PR is on its way :)

--
components: Tests
messages: 410800
nosy: sobolevn
priority: normal
severity: normal
status: open
title: Direct invocation of `Lib/test/test_typing.py` fails
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



[issue46416] Direct invocation of `Lib/test/test_typing.py` fails

2022-01-17 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue46415] ipaddress.ip_{address, network, interface} raise TypeError instead of ValueError if given a tuple as address

2022-01-17 Thread Thomas Cellerier


Change by Thomas Cellerier :


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

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

>self.assertEqual(repr(type), '')

For this one, I suggest to replace the value with "..." doctest pattern.

--

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread Ethan Furman


Ethan Furman  added the comment:

vstinner wrote:
--
>>self.assertEqual(repr(type), '')

> For this one, I suggest to replace the value with "..." doctest pattern.

That bit of code is from the unittest suite, not the doctest suite.

I went with:  

self.assertEqual(repr(type), '' % type.value)

--

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +28846
pull_request: https://github.com/python/cpython/pull/30643

___
Python tracker 

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



[issue46415] ipaddress.ip_{address, network, interface} raises TypeError instead of ValueError if given a tuple as address

2022-01-17 Thread Thomas Cellerier


Change by Thomas Cellerier :


--
title: ipaddress.ip_{address,network,interface} raise TypeError instead of 
ValueError if given a tuple as address -> 
ipaddress.ip_{address,network,interface} raises TypeError instead of ValueError 
if given a tuple as address

___
Python tracker 

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



[issue46414] Add typing.reveal_type

2022-01-17 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
nosy: +sobolevn

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

I created https://github.com/python/core-workflow/issues/424 "Should we make 
the Docs CI mandatory on the Python main branch?".

--

___
Python tracker 

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



[issue46405] Warning compiling main on Windows

2022-01-17 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset a4bc2218d270c4c7a898c8b3967c8c271afe9abe by Kumar Aditya in 
branch 'main':
bpo-46405: fix msvc compiler warnings (GH-30627)
https://github.com/python/cpython/commit/a4bc2218d270c4c7a898c8b3967c8c271afe9abe


--

___
Python tracker 

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



[issue46414] Add typing.reveal_type

2022-01-17 Thread Marc Mueller


Change by Marc Mueller :


--
nosy: +cdce8p

___
Python tracker 

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



[issue25710] zipimport is not PEP 3147 or PEP 488 compliant

2022-01-17 Thread László Kiss Kollár

Change by László Kiss Kollár :


--
nosy: +lkollar

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 62a6594e66ca955073be2f4e5a40291a39252ef3 by Ethan Furman in 
branch 'main':
bpo-40066: [Enum] fix tests (GH-30643)
https://github.com/python/cpython/commit/62a6594e66ca955073be2f4e5a40291a39252ef3


--

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2022-01-17 Thread Ethan Furman


Change by Ethan Furman :


--
priority: release blocker -> normal
resolution:  -> fixed
stage: patch review -> resolved

___
Python tracker 

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



[issue46108] Enum repr() incorrect when mixed with non-__new__ data types

2022-01-17 Thread Ethan Furman


Ethan Furman  added the comment:

Fixed in 3.11.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
superseder:  -> Enum: modify __repr__, __str__; update docs
type:  -> behavior

___
Python tracker 

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



  1   2   >