[issue11422] indentation problem in if, elif, else statements

2011-03-06 Thread Victor

New submission from Victor :

Hi dear developers,
"Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on 
win32"
Hello,
Several days ago I downloaded Python 3.2, the standard windows installer, for 
windows vista. Here's the bug:
in the Python-command line, the following works:
"
>>>if 2==2:print('yes')
...else:print('n')
...
yes
"
Now, in the Python shell (IDLE-python gui, the standard one included with the 
installer of python), the only way it works is:
>>> if 2==2:print('yes')
else:print('n')

yes

So, it requires me to put "else" unindented. On the other hand, if the 
"if--else" statement is included in the definition of a function, then it 
requires that "else" be exactly under "if". Same is true when using "elif".
This was frustrating, when trying to learn "if-else" statement, because it took 
me half an hour of experimenting.
Shouldn't it be consistent?

Victor

--
components: Regular Expressions
messages: 130219
nosy: victorywin
priority: normal
severity: normal
status: open
title: indentation problem in if, elif, else statements
type: behavior
versions: Python 3.2

___
Python tracker 
<http://bugs.python.org/issue11422>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11423] .py file does not open on click

2011-03-06 Thread Victor

New submission from Victor :

Hi dear developers,
**Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on 
win32** (windows vista; standard python installer for windows)
I am new to python. In the documentation I read that a .py file should run just 
on clicking it. 
I do so, but nothing happens (or at most, I can see something opening for just 
a fraction of second, then it immediately closes). Same when I try to open it 
(with the right-click open menu) with python, pythonw.
Is that normal? The way I do then, is to open the IDLE (python shell) and from 
there--"open file".
(Also, I don't manage to use the "from file_name import*" command (in python 
shell IDLE), but I guess that will be another report.)

--
components: None
messages: 130220
nosy: victorywin
priority: normal
severity: normal
status: open
title: .py file does not open on click
type: behavior
versions: Python 3.2

___
Python tracker 
<http://bugs.python.org/issue11423>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11422] indentation problem in if, elif, else statements

2011-03-06 Thread Victor

Victor  added the comment:

Thanks, people.
Now I understood that both "if" and "else" should be always at the beginning of 
the lines they are sitting on.

--

___
Python tracker 
<http://bugs.python.org/issue11422>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11433] syntax error at "while" statement in IDLE/python shell

2011-03-07 Thread Victor

New submission from Victor :

Hi and please help me understand if it is a bug, or..,as someone said, there's 
a 'bug' in my understanding:
(Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on 
win32) (windows vista, the regular windows python installer)
It's about the following code:

while True:
s = input('Enter something : ')
if s == 'quit':
break
print('Length of the string is', len(s))
print('Done')

when I put it in the IDLE's editor, and run it from there ("Run module F5"), it 
runs fine; but when I try to type it in the python shell (IDLE), or in the 
python command line, it gives errors, though I tried to edit it differently:

>>> while True:
s = input('Enter something : ')
if s == 'quit':
break
print('Length of the string is', len(s))
print('Done')
SyntaxError: invalid syntax
>>> while True:
s = input('Enter something : ')
if s == 'quit':
break
print('Length of the string is', len(s))
print('Done')
SyntaxError: unindent does not match any outer indentation level
>>>

The only way I noticed it would accept is to set the last "print" statement 
directly under/in the block of "while": which is not the intention. (According 
to the docs, while statement should work without the "else" option). Is this a 
bug?
Thanks, Victor
p.s. the example is taken from http://swaroopch.com/notes/Python_en:Control_Flow

--
components: IDLE
messages: 130261
nosy: victorywin
priority: normal
severity: normal
status: open
title: syntax error at "while" statement in IDLE/python shell
type: behavior
versions: Python 3.2

___
Python tracker 
<http://bugs.python.org/issue11433>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11413] Idle doesn't start

2011-03-07 Thread Victor

Victor  added the comment:

How do you try to open the IDLE? For example, I open it from the start menu, 
python3.2. When you try to double click on a .py file, it is normal to see what 
you describe.

--
nosy: +victorywin

___
Python tracker 
<http://bugs.python.org/issue11413>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6782] Scoping of variables in closures

2009-08-25 Thread victor

New submission from victor :

I can't tell if this is "feature" or a "bug" but either way this
behavior struck me as strange.
"""
def func():
  x = 5
  def inc():
temp = x + 1 # when inc() is execute, this line fails
x = temp
return x
  return inc

i = func()
i() # will raise error
"""
It says that x referenced before defined (when computing x + 1). It
seems that the fact that x is assigned in the local inc() that it
shadows the outer x.
Even stranger is that if you remove the the assignment of "x = temp"
there is no error; suggesting the assignment to x anywhere in the inner
function shadows the entire function. 

This is not the expected behavior, so I thought it may be bug.

--
components: Interpreter Core
messages: 91954
nosy: bitfort
severity: normal
status: open
title: Scoping of variables in closures
type: behavior
versions: Python 2.6

___
Python tracker 
<http://bugs.python.org/issue6782>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5285] hmac throws TypeErrors

2009-02-20 Thread victor

Changes by victor :


--
nosy: +victorstar

___
Python tracker 
<http://bugs.python.org/issue5285>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://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 
<https://bugs.python.org/issue46016>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46034] Patch-adding __init__ in a class takes no effect when called from a subinterpreter

2021-12-10 Thread STINNER Victor


STINNER Victor  added the comment:

I mark this issue as a duplicate of bpo-46006. It's not exactly the same issue, 
but the root cause is the same: in some functions, Python use fast pointer 
comparisons when two strings are interned, but this now fails if two interned 
strings belong to two different interpreters.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue46034>
___
___
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-10 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-46034 as a duplicate: setting a class "__init__" attribute doesn't 
update properly its tp_init slot. update_slot() of Objects/typeobject.c only 
uses a fast pointer comparison since both strings are interned, but the test 
fails if the two strings are part of two different Python interpreters.

In bpo-46034 case, the problem is that the "slotdefs" array uses interned 
strings created in the main interpreter, whereas the update_slot() name 
parameter (Python string) was created in a sub-interpreter.

Reproducer:
=
import _testcapi

code = r"""class Greeting():
pass

def new_init(inst, name):
inst.text = f"Hello, {name}\n"

Greeting.__init__ = new_init

Greeting("Miro")"""

_testcapi.run_in_subinterp(code)
=

--

___
Python tracker 
<https://bugs.python.org/issue46006>
___
___
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-10 Thread STINNER Victor


STINNER Victor  added the comment:

Attachd cmp_interned_strings.patch fix _PyUnicode_EqualToASCIIId() and 
update_slot() for subinterpreters. I will create a PR once we agree if it's 
required to support subinterpreters there, and if there is no better (faster) 
option.

For update_slot(), one option to avoid adding a "slow" _PyUnicode_EQ() call 
would be to have per-interpreter interned strings for the slotdefs array.

--
keywords: +patch
Added file: https://bugs.python.org/file50485/cmp_interned_strings.patch

___
Python tracker 
<https://bugs.python.org/issue46006>
___
___
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-10 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +3.10regression
nosy: +pablogsal
priority: normal -> release blocker

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



[issue9504] signal.signal/signal.alarm not working as expected

2021-12-10 Thread STINNER Victor


STINNER Victor  added the comment:

https://www.python.org/dev/peps/pep-0475/ changed deeply how Python handles 
signals. Python now tries to restart syscalls interrupted by signals (EINTR). A 
Python function only raises an exception if the Python signal handler raises an 
exception.

--
status: pending -> open

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



[issue20559] urllib/http fail to sanitize a non-ascii url

2021-12-10 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

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



[issue14484] missing return in win32_kill?

2021-12-13 Thread STINNER Victor


STINNER Victor  added the comment:

IMO trying to mimic POSIX behavior on Windows in the single function os.kill() 
was a bad design idea. Windows should have its own specific function.

--

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



[issue45643] SIGSTKFLT is missing from the signals module on Linux

2021-12-13 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset a62be77266b1beadd42d4952186332bc0847b7d6 by Gareth Rees in branch 
'main':
bpo-45643: Add signal.SIGSTKFLT on platforms where this is defined (GH-29266)
https://github.com/python/cpython/commit/a62be77266b1beadd42d4952186332bc0847b7d6


--

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



[issue45643] Add signal.SIGSTKFLT constant (Linux)

2021-12-13 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
title: SIGSTKFLT is missing from the signals module on Linux -> Add 
signal.SIGSTKFLT constant (Linux)

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



[issue45643] Add signal.SIGSTKFLT constant (Linux)

2021-12-13 Thread STINNER Victor


STINNER Victor  added the comment:

I merged your PR, thanks!

I'm curious how people use this signal :-)

--

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



[issue40927] ./python -m test test___all__ test_binhex fails

2021-12-13 Thread STINNER Victor


STINNER Victor  added the comment:

Oh thanks Irit! It's too easy to forget closing an issue!

--

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



[issue30716] Failing tests with installed 3.6.2rc1 on Win 10-64

2021-12-13 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like this issue has been fixed in bpo-27425.

--
resolution: out of date -> duplicate
superseder:  -> Tests fail because of git's newline preferences on Windows

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



[issue21390] readline: setlocale() returns NULL on Android

2021-12-13 Thread STINNER Victor


STINNER Victor  added the comment:

Since 2014, Android got getter support for Unix locales.

Since nobody was able to say if the issue still exists on Android since 2014, 
nor if my patch fix the issue, I perfer to close the issue as out of date.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

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



[issue12411] cgi.parse_multipart is broken on 3.x

2021-12-13 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner
status: pending -> open

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



[issue23469] Delete Misc/*.wpr files

2021-12-13 Thread STINNER Victor


STINNER Victor  added the comment:

IMO it's ok to remove these files. If WING is maintained again, it will be 
trivial to add again these configuratin files. I suggest to only remove these 
files in Python 3.11.

--
nosy: +vstinner

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



[issue34624] -W option and PYTHONWARNINGS env variable does not accept module regexes

2021-12-13 Thread STINNER Victor


STINNER Victor  added the comment:

Oh, I didn't know this issue. I closed my issue bpo-43862 as a duplicate.

--
nosy: +vstinner

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



[issue43862] warnings: -W option and PYTHONWARNINGS now use the message as a regex

2021-12-13 Thread STINNER Victor


STINNER Victor  added the comment:

I mark this issue as a duplicate of bpo-34624.

--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> -W option and PYTHONWARNINGS env variable does not accept 
module regexes

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



[issue34624] -W option and PYTHONWARNINGS env variable does not accept module regexes

2021-12-13 Thread STINNER Victor


STINNER Victor  added the comment:

> Adding regular expression support to -W and PYTHONWARNINGS env var turns the 
> options into potential attack vectors.

Why would an attacker control these options?

If an attacker controls how Python is run, they are more efficient way to take 
control of Python and execute arbitrary code, than just trigger a denial of 
service, no

--

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



[issue34624] -W option and PYTHONWARNINGS env variable does not accept module regexes

2021-12-13 Thread STINNER Victor


STINNER Victor  added the comment:

One option is to keep the current behavior by default, but support a new 
"/regex/" format. The /regex/ format is commonly used in Perl and sed.

Example to ignore warnings containing "deprecated" string in their message:


   python3 -W "ignore:/deprecated/"
   PYTHONWARNINGS="ignore:/deprecated/"

whereas the following commands continue to match exactly the whole warning 
message "deprecated":

   python3 -W "ignore:deprecated"
   PYTHONWARNINGS="ignore:deprecated"

--

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



[issue31370] Remove support for threads-less builds

2021-12-13 Thread STINNER Victor


STINNER Victor  added the comment:

> This has unfortunately turned out to be a blocker on getting WASI support as 
> there's not direct threading support in WebAssembly.

This issue is now closed and unrelated to WASI support. Can you please open a 
new separated issue for it?

--

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



[issue31370] Remove support for threads-less builds

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

Either reopen the issue or open a new issue. Only people subscribed to this bug 
are aware of the recent comments. Closed issues are hidden from the bugs home 
page and from the default search.

If you consider that Python must again support thread-less platforms, IMO it's 
a new feature and a new issue must be opened.

--

___
Python tracker 
<https://bugs.python.org/issue31370>
___
___
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-15 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 
<https://bugs.python.org/issue46006>
___
___
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-15 Thread STINNER Victor


STINNER Victor  added the comment:

I created PR 30123 to fix _PyUnicode_EqualToASCIIId() and type update_slot() 
functions. I added comments explaining why we can no longer optimize the 
comparison of two interned string objects.

--

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



[issue40533] [subinterpreters] Don't share Python objects between interpreters

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

Until all Python stdlib C extensions and all third-party C extensions will be 
modified to no longer use and define static types and will stop shared Python 
objects between two interpreters, we can no longer micro-optimize the 
comparison of two interned strings by only comparing their memory addresse. See 
bpo-46006.

--

___
Python tracker 
<https://bugs.python.org/issue40533>
___
___
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-15 Thread STINNER Victor


STINNER Victor  added the comment:

These bug prevent the Fedora infra team from upgrading the Koji builders to 
Fedora 35. Koji runs on mod_wsgi which is affected by the bug:
https://bugzilla.redhat.com/show_bug.cgi?id=2030621#c1

--

___
Python tracker 
<https://bugs.python.org/issue46006>
___
___
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-15 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-46070: I don't know if it's related.

--

___
Python tracker 
<https://bugs.python.org/issue46006>
___
___
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-15 Thread STINNER Victor


STINNER Victor  added the comment:

Mark: "As Victor points out, there is no bug in 3.9 because interned strings 
are common across all interpreter. We should revert that behavior."

The rationale for having per-interpreter interned strings and per-interpreter 
_Py_IDENTIFIER() string objects can be found in bpo-39465 and bpo-40521.

--

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



[issue41682] [Windows] test_asyncio: Proactor test_sendfile_close_peer_in_the_middle_of_receiving failure

2021-12-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

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



[issue46070] broken subinterpreters

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

I can sometimes reproduce the crash on Windows with Python 3.9. Call stack 
(most recent to oldest frames):

* PyObject_GC_UnTrack() - crash on _PyGCHead_SET_NEXT(prev, next) because prev 
is dangling pointer (0x1fe64dd5250), Visual Studio is unable to read memory
* meth_dealloc() -- delete _sre_compile() method object
* (...)
* PyDict_SetItem() -- set "compile" to None
* _PyModule_ClearDict() -- clear the "_sre" module dict
* _PyModule_Clear()
* _PyImport_Clenaup()
* Py_EndInterpreter()
* (...)
* run_in_subinterp()
* (...)
* t_bootstrap()

The crash occurs in meth_dealloc(), when deallocating the _sre_compile() method 
object stored in _sre module dictionary as the attribute "compile".

The PyGC_Head.prev pointer is a dangling pointer.

On Python 3.9, the "re" module is not imported at startup, but it's imported 
indirectly by "import importlib.util" via "import typing". On Python 3.10, the 
re module is no longer imported by "import importlib.util".

The crash is random. Sometimes, I need 3 or 4 tries. Sometimes, it crash using 
-X dev. Sometimes, it crash immediately. When debugging in Visual Stuido, the 
crash seems easier to reproduce.

On Python 3.9, the _sre exetnsion uses the old API: PyModule_Create() with 
PyModuleDef.m_size = -1.

On Python 3.10, the _sre extension has been converted to multiphase init API: 
PyModuleDef_Init() with PyModuleDef.m_size = sizeof(_sremodulestate). Moreover, 
"import importlib.util" no longer imports indirectly the "re" module.

--

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



[issue46070] broken subinterpreters

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

Using attached bug.py, it's possible to trigger the crash on the main branch. I 
modified the reproducer to use the "_asyncio" extension which still uses the 
old API PyModule_Create() with PyModuleDef.m_size = -1.

--
Added file: https://bugs.python.org/file50497/bug.py

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



[issue46070] _PyImport_FixupExtensionObject() regression causing a crash in subintepreters

2021-12-15 Thread STINNER Victor


Change by STINNER Victor :


--
title: broken subinterpreters -> _PyImport_FixupExtensionObject() regression 
causing a crash in subintepreters

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



[issue46070] _PyImport_FixupExtensionObject() regression causing a crash in subintepreters

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

Hum, maybe bug.py exposes a different kind of bug. The _asyncio extension uses 
a non-trivial initialize code which doesn't seem to handle well concurrent 
"import _asyncio".

--

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



[issue46070] _PyImport_FixupExtensionObject() regression causing a crash in subintepreters

2022-01-04 Thread STINNER Victor


STINNER Victor  added the comment:

Fedora issue: https://bugzilla.redhat.com/show_bug.cgi?id=2034962

--

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-05 Thread STINNER Victor


STINNER Victor  added the comment:

If the issue is about how pyperformance creates its virtual environment (how 
setuptools is installed), I suggest to continue discussion the issue in 
pyperformance: https://github.com/python/pyperformance/issues/ ;-)

--

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



[issue46142] python --help output is too long

2022-01-05 Thread STINNER Victor


STINNER Victor  added the comment:

initconfig.c parses all -X options. preconfig.c also checks for a few specific 
-X options which are also checked in initconfig.c.

My notes on parsing command line options:
https://pythondev.readthedocs.io/pyconfig.html#add-a-new-command-line-option

--

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



[issue46178] Remove `.travis.yml`?

2022-01-05 Thread STINNER Victor


STINNER Victor  added the comment:

I had so many troubles with Travis CI. I'm happy that GitHub Actions is more 
reliable and that Travis CI is gone.

--
nosy: +vstinner

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



[issue46205] Race condition in runtest_mp leads to hangs (never exits)

2022-01-05 Thread STINNER Victor


STINNER Victor  added the comment:

Do you want to work on a fix?

--

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



[issue46205] test.libregrtest: Race condition in runtest_mp leads to hangs (never exits)

2022-01-05 Thread STINNER Victor


Change by STINNER Victor :


--
components: +Tests
title: Race condition in runtest_mp leads to hangs (never exits) -> 
test.libregrtest: Race condition in runtest_mp leads to hangs (never exits)

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



[issue46070] _PyImport_FixupExtensionObject() regression causing a crash in subintepreters

2022-01-05 Thread STINNER Victor


STINNER Victor  added the comment:

I applied PR 30123 of bpo-46006: "./python bug.py" does still crash. So 
bpo-46006 is unrelated to this issue.

--

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



[issue46070] _PyImport_FixupExtensionObject() regression causing a crash in subintepreters

2022-01-05 Thread STINNER Victor


STINNER Victor  added the comment:

bug.py:

* Python 3.7 branch doesn't crash
* Python 3.8 branch does crash

So the regression was introduced in Python 3.8.

git bisect points me to this change:
---
commit 13915a3100608f011b29da2f3716c990f523b631 (refs/bisect/bad)
Author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
Date:   Mon Oct 7 09:38:00 2019 -0700

bpo-36356: Fix memory leak in _asynciomodule.c (GH-16598)

(cherry picked from commit 321def805abc5b7c92c7e90ca90cb2434fdab855)

Co-authored-by: Ben Harper 
---

Before this change, bug.py doesn't crash. With this change, bug.py does crash.

--

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



[issue46070] [subinterpreters] asyncio crash when importing _asyncio in subinterpreter (Python 3.8 regression)

2022-01-05 Thread STINNER Victor


Change by STINNER Victor :


--
title: _PyImport_FixupExtensionObject() regression causing a crash in 
subintepreters -> [subinterpreters] asyncio crash when importing _asyncio in 
subinterpreter (Python 3.8 regression)

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



[issue46070] [subinterpreters] asyncio crash when importing _asyncio in subinterpreter (Python 3.8 regression)

2022-01-05 Thread STINNER Victor


STINNER Victor  added the comment:

> bpo-36356: Fix memory leak in _asynciomodule.c (GH-16598)

Python 3.8.0 is the first Python version containing this change. So it looks 
like a Python 3.8 regression.

--

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2022-01-05 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28626
pull_request: https://github.com/python/cpython/pull/30422

___
Python tracker 
<https://bugs.python.org/issue40521>
___
___
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

2022-01-05 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28627
pull_request: https://github.com/python/cpython/pull/30422

___
Python tracker 
<https://bugs.python.org/issue46006>
___
___
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

2022-01-05 Thread STINNER Victor


STINNER Victor  added the comment:

IMO writing a complete rationale for running multiple interpreters in parallel 
which require a whole PEP. I didn't write such PEP yet since there are still 
non-trivial technical issues, especially the problem of static types: bpo-40601.

I don't have time right now to measure the performance overhead of PR 30123 on 
_PyUnicode_EqualToASCIIId() and on changing a type attribute (like overriding 
the __init__() method). I expect a minor overhead on micro-benchmark and no 
significant change on pyperformance macrobenchmarks. But again, right I don't 
have time to go through such analysis.

The priority for now is to unblock the Python 3.11 release and repair the 
Python 3.10 regression, so I'm fine with reverting my commit 
ea251806b8d11b30d2182af1e589caf88acf which introduced the regression.

PR 30131 makes more changes than just reverting the commit, it changes the 
_PyRuntimeState structure and it also reverts the identifiers change, whereas 
so far, there is no known relationship between this issue and identifiers. IMO 
it's ok to leave identifiers unchanged.

--

___
Python tracker 
<https://bugs.python.org/issue46006>
___
___
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

2022-01-05 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 35d6540c904ef07b8602ff014e520603f84b5886 by Victor Stinner in 
branch 'main':
bpo-46006: Revert "bpo-40521: Per-interpreter interned strings (GH-20085)" 
(GH-30422)
https://github.com/python/cpython/commit/35d6540c904ef07b8602ff014e520603f84b5886


--

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2022-01-05 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 35d6540c904ef07b8602ff014e520603f84b5886 by Victor Stinner in 
branch 'main':
bpo-46006: Revert "bpo-40521: Per-interpreter interned strings (GH-20085)" 
(GH-30422)
https://github.com/python/cpython/commit/35d6540c904ef07b8602ff014e520603f84b5886


--

___
Python tracker 
<https://bugs.python.org/issue40521>
___
___
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

2022-01-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28630
pull_request: https://github.com/python/cpython/pull/30425

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2022-01-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28631
pull_request: https://github.com/python/cpython/pull/30425

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



[issue46277] '''...''' error

2022-01-06 Thread STINNER Victor


STINNER Victor  added the comment:

vstinner@apu$ python3
Python 3.10.1 (main, Dec  9 2021, 00:00:00) [GCC 11.2.1 20211203 (Red Hat 
11.2.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> str_='''...
... ...
... ..
... ..
... .
... ...
... '''
>>> str_
'...\n...\n..\n..\n.\n...\n'

I cannot reproduce this issue in the Python REPL. I suggest to report the issue 
to jupyter.

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue46277>
___
___
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

2022-01-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28639
pull_request: https://github.com/python/cpython/pull/30433

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2022-01-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28640
pull_request: https://github.com/python/cpython/pull/30433

___
Python tracker 
<https://bugs.python.org/issue40521>
___
___
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

2022-01-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 72c260cf0c71eb01eb13100b751e9d5007d00b70 by Victor Stinner in 
branch '3.10':
[3.10] bpo-46006: Revert "bpo-40521: Per-interpreter interned strings 
(GH-20085)" (GH-30422) (GH-30425)
https://github.com/python/cpython/commit/72c260cf0c71eb01eb13100b751e9d5007d00b70


--

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2022-01-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 72c260cf0c71eb01eb13100b751e9d5007d00b70 by Victor Stinner in 
branch '3.10':
[3.10] bpo-46006: Revert "bpo-40521: Per-interpreter interned strings 
(GH-20085)" (GH-30422) (GH-30425)
https://github.com/python/cpython/commit/72c260cf0c71eb01eb13100b751e9d5007d00b70


--

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



[issue46283] [subinterpreters] Unicode interned strings must not be shared between interpreters

2022-01-06 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +eric.snow

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



[issue46283] [subinterpreters] Unicode interned strings must not be shared between interpreters

2022-01-06 Thread STINNER Victor


New submission from STINNER Victor :

My commit ea251806b8d11b30d2182af1e589caf88acf made Unicode interned 
strings per interpreter to avoid accessing the same Python object from two 
different interpreters, to avoid race conditions on its reference count.

Problem: the change introduced the bpo-46006 regression in 
_PyUnicode_EqualToASCIIId() and type update_slot() functions which make the 
assumption that if two strings are interned and their pointers are not equal: 
these strings are not equal.

I proposed PR 30123 to fix these two functions, but then questions have been 
asked about the overall goal, running multiple Python interpreters in parallel 
in the same process (bpo-40512):
https://bugs.python.org/issue46006#msg408002

bpo-46006 was blocking the Python 3.11.0a4 release, Python 3.10 was affected 
and there were more and more affected projects:

* jep: https://github.com/ninia/jep/issues/358
* mod_wsgi: https://github.com/GrahamDumpleton/mod_wsgi/issues/729
* weechat-matrix: https://github.com/poljar/weechat-matrix/issues/293
* Fedora issue about mod_wsgi and weechat-matrix: 
https://bugzilla.redhat.com/show_bug.cgi?id=2030621

So I decided to just revert the change on interned strings:

* main branch: commit 35d6540c904ef07b8602ff014e520603f84b5886
* 3.10 branch: commit 72c260cf0c71eb01eb13100b751e9d5007d00b70 (with changes to 
keep the ABI backward compatibility)

These interned strings are preventing again to run multiple interpreters in 
parallel, two subinterpreters must not access the same Python object: see 
bpo-40533.

I suggest to write a PEP to explain the rationale, and reapply my commit 
ea251806b8d11b30d2182af1e589caf88acf with PR 30123.

--
components: Subinterpreters
messages: 409860
nosy: vstinner
priority: normal
severity: normal
status: open
title: [subinterpreters] Unicode interned strings must not be shared between 
interpreters
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue46283>
___
___
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

2022-01-06 Thread STINNER Victor


STINNER Victor  added the comment:

_PyUnicode_EqualToASCIIId() and type update_slot() functions are fixed in 3.10 
and main branches. The regression is now fixed.

But the revert reintroduces the issue on subinterpreters, so I created 
bpo-46283: "[subinterpreters] Unicode interned strings must not be shared 
between interpreters".

--

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2022-01-06 Thread STINNER Victor


STINNER Victor  added the comment:

My commit ea251806b8d11b30d2182af1e589caf88acf (interned strings) 
introduced bpo-46006 "[subinterpreter] _PyUnicode_EqualToASCIIId() issue with 
subinterpreters" regression.

To unblock the Python 3.11.0a4 release, I just reverted the change. It 
reintroduces the issue, so I created bpo-46283: "[subinterpreters] Unicode 
interned strings must not be shared between interpreters".

--

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



[issue46142] python --help output is too long

2022-01-06 Thread STINNER Victor


STINNER Victor  added the comment:

"xoptions" name comes from sys._xoptions (Python) and PyConfig.xoptions (C). 
Oh, sys._xoptions is a private API... but it's mentioned in the -X 
documentation:
https://docs.python.org/3/using/cmdline.html#cmdoption-X

--

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



[issue46070] [subinterpreters] asyncio crash when importing _asyncio in subinterpreter (Python 3.8 regression)

2022-01-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b127e70a8a682fe869c22ce04c379bd85a00db67 by Erlend Egeberg 
Aasland in branch 'main':
bpo-46070: Fix asyncio initialisation guard (GH-30423)
https://github.com/python/cpython/commit/b127e70a8a682fe869c22ce04c379bd85a00db67


--

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



[issue46070] [subinterpreters] asyncio crash when importing _asyncio in subinterpreter (Python 3.8 regression)

2022-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

Even with PR 30454, I can still reproduce the crash on Python 3.9 (randomly, it 
takes a few attempts to reproduce the crash):

vstinner@DESKTOP-DK7VBIL C:\vstinner\python\3.9>python -X dev 
win_py399_crash_reproducer.py 
Running Debug|x64 interpreter...
exit subinterpreter
exit subinterpreter
exit subinterpreter
Windows fatal exception: access violation

Thread 0x2230 (most recent call first):


Thread 0x2124 (most recent call first):
  File "C:\vstinner\python\3.9\win_py399_crash_reproducer.py", line 13 in doIt
  File "C:\vstinner\python\3.9\lib\threading.py", line 910 in run
  File "C:\vstinner\python\3.9\lib\threading.py", line 973 in _bootstrap_inner
  File "C:\vstinner\python\3.9\lib\threading.py", line 930 in _bootstrap

Current thread 0x27f0 (most recent call first):
  File "C:\vstinner\python\3.9\win_py399_crash_reproducer.py", line 13 in doIt
  File "C:\vstinner\python\3.9\lib\threading.py", line 910 in run
  File "C:\vstinner\python\3.9\lib\threading.py", line 973 in _bootstrap_inner
  File "C:\vstinner\python\3.9\lib\threading.py", line 930 in _bootstrap

Thread 0x1c18 (most recent call first):
  File "C:\vstinner\python\3.9\lib\threading.py", line 312 in wait
  File "C:\vstinner\python\3.9\lib\threading.py", line 574 in wait
  File "C:\vstinner\python\3.9\lib\threading.py", line 897 in start
  File "C:\vstinner\python\3.9\win_py399_crash_reproducer.py", line 19 in 


--

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



[issue46070] [subinterpreters] asyncio crash when importing _asyncio in subinterpreter (Python 3.8 regression)

2022-01-07 Thread STINNER Victor

STINNER Victor  added the comment:

> The problematic change could be (d0d29655ff) affecting import.c

This change is part of the 3.10 branch. For 3.9, git bisect tells me that it's 
the following change:

commit 52d9d3b75441ae6038fadead89eac5eecdd34501
Author: Łukasz Langa 
Date:   Tue Oct 5 22:30:25 2021 +0200

[3.9] bpo-44050: Extension modules can share state when they don't support 
sub-interpreters. (GH-27794) (GH-28741)

(cherry picked from commit b9bb74871b27d9226df2dd3fce9d42bda8b43c2b)

Co-authored-by: Hai Shi 


The problem is that this change fixed another bug, well, see: bpo-44050. While 
a revert should fix win_py399_crash_reproducer.py, it will reintroduce 
bpo-44050 bug.

--

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



[issue46070] [subinterpreters] asyncio crash when importing _asyncio in subinterpreter (Python 3.8 regression)

2022-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

I reverted manually the commit 52d9d3b75441ae6038fadead89eac5eecdd34501 (in my 
local Python 3.9 checkout): I confirm that the revert fix the  
win_py399_crash_reproducer.py crash in Python 3.9.

--

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



[issue46070] [subinterpreters] asyncio crash when importing _asyncio in subinterpreter (Python 3.8 regression)

2022-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

In the 3.9 branch, the commit 4d2cfd354969590ba8e0af0447fd84f8b5e61952 fixed 
the _asyncio extension. win_py399_crash_reproducer.py still branch on Windows 
in the 3.9 branch. The code can be simplified with:

code = "import _sre"

Moreover, even if I modify PyInit__sre() to only call PyModule_Create(), it 
does still crash. I can still reproduce the crash with the following simplified 
_sre.c code:
---
static PyMethodDef _functions[] = {
_SRE_COMPILE_METHODDEF
{NULL, NULL}
};

static struct PyModuleDef sremodule = {
PyModuleDef_HEAD_INIT,
"_" SRE_MODULE,
NULL,
-1,
_functions,
NULL,
NULL,
NULL,
NULL
};

PyMODINIT_FUNC PyInit__sre(void)
{
return PyModule_Create(&sremodule);
}
---

If _SRE_COMPILE_METHODDEF is removd from _functions, the script no longer crash.

Is there something specific about method objects? Is it safe to share them 
between multiple interpreters? See my message msg408662 which gives some 
details.

--

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



[issue15751] [subinterpreters] Make the PyGILState API compatible with subinterpreters

2022-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

The bpo-46295 was marked as a duplicate of this issue.

--

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



[issue46070] [subinterpreters] asyncio crash when importing _asyncio in subinterpreter (Python 3.8 regression)

2022-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

The _sre crash has a complex history in the 3.9 branch:

* (1) 2019-11-20, commit 7247407c35330f3f6292f1d40606b7ba6afd5700: first CRASH! 
The parent commit (488d02a24142948bfb1fafd19fa48e61fcbbabc5) doesn't crash.
* (2) 2019-11-22, commit 82c83bd907409c287a5bd0d0f4598f2c0538f34d: no crash 
(fix/workaround the crash)
* (3) 2021-10-05, commit 52d9d3b75441ae6038fadead89eac5eecdd34501: crash again! 
(somehow revert the previous fix/workaround the crash, but fix another bug)

It seems like the initial regression comes from this change:

commit 7247407c35330f3f6292f1d40606b7ba6afd5700
Author: Victor Stinner 
Date:   Wed Nov 20 12:25:50 2019 +0100

bpo-36854: Move _PyRuntimeState.gc to PyInterpreterState (GH-17287)

* Rename _PyGC_InitializeRuntime() to _PyGC_InitState()
* finalize_interp_clear() now also calls _PyGC_Fini() in
  subinterpreters (clear the GC state).

--

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



[issue46070] [subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression)

2022-01-07 Thread STINNER Victor


Change by STINNER Victor :


--
title: [subinterpreters] asyncio crash when importing _asyncio in 
subinterpreter (Python 3.8 regression) -> [subinterpreters] crash when 
importing _sre in subinterpreters in parallel (Python 3.9 regression)

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



[issue46070] [subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression)

2022-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

This bug is hard to reproduce for different reasons:

* It occurs randomly: I need between 1 and 50 attempts to reproduce the bug 
using win_py399_crash_reproducer.py

* So far, the bug was only reproduced on Windows.

* I failed to reproduce the crash on Linux. I tried PYTHONMALLOC=malloc and 
PYTHONMALLOC=malloc_debug with and without 
LD_PRELOAD=/usr/lib64/libjemalloc.so.2 (jemalloc memory allocator).

* The _sre extension has been converted to multi-phase init in Python 3.10. 
"import _sre" is no longer enough to reproduce the crash on Python 3.10 and 
newer.

--

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28688
pull_request: https://github.com/python/cpython/pull/30484

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-08 Thread STINNER Victor


STINNER Victor  added the comment:

It's not the first time that private functions included by the public Python.h 
are causing build errors event if these functions are not used. The previous 
issue were functions for atomic operations. I solved this build error by moving 
the whole private C API into the internal C API: 
Include/internal/pycore_atomic.h. Since that time, we no longer got build error 
related to this header file.

I propose a similar fix: move all private fileutils.h functions from 
Include/cpython/fileutils.h to the internal Include/internal/pycore_fileutils.h.

I wrote PR 30484 to implement this change.

To keep the implementation simple, I kept _Py_fopen_obj() in 
Include/cpython/fileutils.h, for _testcapi which must not use the internal C 
API.

If this PR is merged, for Python 3.9 and 3.10, I will write a simpler change: 
modify Include/cpython/fileutils.h to only define functions using "struct stat" 
in the internal C API (if Py_BUILD_CORE is defined).

--

___
Python tracker 
<https://bugs.python.org/issue46303>
___
___
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

2022-01-08 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

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



[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

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



[issue46142] python --help output is too long

2022-01-10 Thread STINNER Victor

STINNER Victor  added the comment:

> Serhiy: What do you think about -hh (and maybe —help-full) printing full help?

Do you know other projects which dump the full help into stdout when asking for 
the "full help"?

For me, the best CLI is "git help", "git help init", etc. "git help init" opens 
"man git-init". I don't know its behaviour on platforms without manpage 
support, like Windows.

--

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset ea1a54506b4ac38b712ba63ec884292025f16111 by Victor Stinner in 
branch 'main':
bpo-46303: Move fileutils.h private functions to internal C API (GH-30484)
https://github.com/python/cpython/commit/ea1a54506b4ac38b712ba63ec884292025f16111


--

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28729
pull_request: https://github.com/python/cpython/pull/30528

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

> While attempting to embed the full cpython source in my application, I found 
> that during compilation on Windows, there was a compilation issue due to 
> struct stat not being defined.

Do you get the error when building Python? Or on #include  when using 
the Python C API?

How do you build Python? What is your C compiler?

Can you test if my proposed PR 30528 fix your issue?

--

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

Python.h indirectly (via fileutils.h) defines _Py_wstat() and _Py_stat() 
functions which use the "struct stat*" type for 12 years:

commit 4e31443c4d2c1fb211a6ea90fc6a8fbd9ff81c97
Author: Victor Stinner 
Date:   Thu Oct 7 21:45:39 2010 +

Create fileutils.c/.h

 * _Py_fopen() and _Py_stat() come from Python/import.c
 * (_Py)_wrealpath() comes from Python/sysmodule.c
 * _Py_char2wchar(), _Py_wchar2char() and _Py_wfopen() come from 
Modules/main.c
 * (_Py)_wstat(), (_Py)_wgetcwd(), _Py_wreadlink() come from 
Modules/getpath.c

--

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28739
pull_request: https://github.com/python/cpython/pull/30539

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like _Py_stat() and _Py_wstat() are only needed on non-Windows 
platforms: only the _get_tcl_lib_path() function of Modules/_tkinter.c uses 
_Py_stat(). I wrote PR 30539 to not define _Py_stat() and _Py_wstat() on 
Windows.

--

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28751
pull_request: https://github.com/python/cpython/pull/30550

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



[issue46346] New compilation warnings on Windows

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

Oh right, I introduced these warnings in bpo-46303. Let's continue the 
discussion there.

--
dependencies:  -_Py_stat and _Py_wstat using incorrect type for status argument
priority: release blocker -> 
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> _Py_stat and _Py_wstat using incorrect type for status argument

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-46346 as a duplicate of this issue. Copy of the first message:

"""
I am getting these warnings:

C:\Users\gvanrossum\cpython\PC\_testconsole.c(70,38): warning C4013: 
'_Py_get_osfhandle' undefined; assuming extern returnin
g int [C:\Users\gvanrossum\cpython\PCbuild\_testconsole.vcxproj]
C:\Users\gvanrossum\cpython\PC\_testconsole.c(70,1): warning C4047: 
'initializing': 'HANDLE' differs in levels of indirectio
n from 'int' [C:\Users\gvanrossum\cpython\PCbuild\_testconsole.vcxproj]
C:\Users\gvanrossum\cpython\Modules\_tkinter.c(144,37): warning C4013: 
'_Py_stat' undefined; assuming extern returning int [
C:\Users\gvanrossum\cpython\PCbuild\_tkinter.vcxproj]

I noticed that GitHub also was flagging these in unrelated PRs.
"""

I proposed GH-30550 to fix these warnings.

--

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



[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

The memory leak has been fixed in 3.10 and main branches. Can this issue be 
closed now?

--
components: +Interpreter Core
versions: +Python 3.10, Python 3.11

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 08bc1bad11cad39f508bd662c9b28fcd9c995512 by Victor Stinner in 
branch 'main':
bpo-46303: Fix fileutils.h compiler warnings (GH-30550)
https://github.com/python/cpython/commit/08bc1bad11cad39f508bd662c9b28fcd9c995512


--

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

Christian Heimes: "I set the release blocker flag for the ticket."

It's just a compiler warning, why marking it as a release blocker?

Anyway, it's now fixed.

--
priority: release blocker -> 

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

Paul: Can you please try to build the main branch of Python with clang and tell 
me if you still have the compiler warnings? If yes, can you please copy/paste 
the compiler warnings?

Do you build Python on Windows or from another OS (cross-compilation)?

--

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

If possible, I would prefer to not change 3.9 and 3.10 to avoid any risk of 
introducing a *new* build error, while trying to support a new platform. I 
don't think that we currently supporting build Python with clang on Windows yet.

--

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

> Hi Victor, I was trying to compile with clang on Windows 10. I will try to 
> pull your 3.11 changes and test. Sorry to cause so much churn. It looked to 
> me like a simple issue that was missed, probably because whatever was trying 
> to compile was not normally compiled on Windows. I was not trying to make a 
> lot of work to support a new platform :)

I tried to write a change which doesn't increase the maintenance on other 
platforms.

I dislike declaring private functions in the *public* Python.h header file, 
especially if they cause build error. Over the last years, I moved many private 
functions to the internal C API.

In Python, we are trying to provide a same C API on all platforms. If "struct 
stat" is no longer considered as portable, IMO we should attempt to avoid it, 
at least in the public C API. For these reasons, I dislike PR 30478. The 
problem is that if the work is written on Linux using "strut stat", the build 
can fail on Windows if "struct _Py_stat_struct" is now required on Windows. I 
expected "struct stat" to be portable, but it seems like I was wrong.

--

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

> Seems it would go back to depending on some type nonstandard python macro to 
> translate between the two during build.

In the internal C API, there are less concerns about writing portable code. We 
expect users of this API to pay more attention to what they do and there is no 
backward compatibility warranty.

In the internal C API, it's acceptable to change the parameter type depending 
on the platform.

--

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



[issue46303] Building Python with clang on Windows fails on _Py_stat(): struct stat is not defined

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

Paul Campbell: "The changes in the main branch gets me past this issue without 
having to make additional changes."

Ok, nice. I close the issue.

I consider that building Python with clang is a new feature. I prefer to not 
backport these changes to 3.9 and 3.10 to avoid any risk of regression.

I wrote GH-30528: simple fix for Python 3.10, but I don't know if it works. I 
don't know how to test my change. It seems like clang is not commonly used on 
Windows, so I close the issue.

If someone wants me to fix build issues with clang on Windows, please comment 
this issue or open a new issue with an error message and a detailed use case.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
title: _Py_stat and _Py_wstat using incorrect type for status argument -> 
Building Python with clang on Windows fails on _Py_stat(): struct stat is not 
defined

___
Python tracker 
<https://bugs.python.org/issue46303>
___
___
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

2022-01-12 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28757
pull_request: https://github.com/python/cpython/pull/30556

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



  1   2   3   4   5   6   7   8   9   10   >