[issue45171] stacklevel handling in logging module is inconsistent

2021-11-08 Thread Jouke Witteveen


Jouke Witteveen  added the comment:

I would expect the opposite. Since the issue is visible only in certain cases 
(shortcut calls such as `logging.info` over `logger.info`, or redirected calls 
such as `logger.warn` which adds a stack frame for redirecting to 
`logger.warning`), any code that uses the stacklevel argument is probably 
broken in subtle ways. It will work fine for the anticipated case, but for 
instance behave weirdly in interactive sessions such as in a debugger.

Added to this, if we want to fix the documentation instead of the logging 
module code, we have to come up with an understandable description of a 
behavior that is really inconsistent and odd. We would probably spend most of 
the documentation explaining edge cases.

--

___
Python tracker 

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



[issue45689] Add the ability to give custom names to threads created by ThreadPoolExecutor

2021-11-08 Thread Tangellapalli Sai Hanuma Rahul


Tangellapalli Sai Hanuma Rahul  added the comment:

There is a new function submit_with_name in _base.Executor that can accept name 
parameters before args and kwargs, submit can continue to be used as before.

submit internally calls submit_with_name with name as None. Calling 
submit_with_name in Executor causes a NotImplementedError, it was only 
implemented in ThreadPoolExecutor, but it could be implemented in any Executor

--

___
Python tracker 

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



[issue45757] dis module incorrectly handles EXTENDED_ARG + NOP sequence

2021-11-08 Thread Irit Katriel

Irit Katriel  added the comment:

We should also verify that the interpreter doesn’t have its own version of the 
dis bug.

--

___
Python tracker 

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



[issue45743] Cleanup and simplify setup.py

2021-11-08 Thread Ned Deily


Ned Deily  added the comment:

>> 1) __APPLE_USE_RFC_3542 should have been in socketmodule.c from the start, 
>> not sure why it was added in setup.py.

> FTR, it was added by me in bpo-35569, GH-19526. I moved the check to setup.py 
> because Ned made me do it :P

Yeah, well, it seemed like a good thing at the time :)

> Something you don't mention is the logic dealing with SDK roots. I haven't 
> checked yet if similar logic would be necessary in configure. With some luck 
> it isn't, but that depends on what's supported by autoconf and the particular 
> probes we want to use.

I haven't looked closely at it in this context but I believe most, if not all, 
of the SDK root shenanigans in setup.py shouldn't be necessary in autoconf 
tests where the Apple compiler driver handles the SDK details and the few other 
cases, like for when there was only a 32-bit version of Tk for macOS, are no 
longer relevant. In any case, that's something for us to follow up on once 
Christian's changes are merged and stabilized on other platforms.

> @Ned: Not being able to use system versions of libraries is a bit annoying, 
> but that's something you already have to do due to openssl.  Maybe we should 
> also try to clean up and refactor the build-installer.py script to do have a 
> way to build/install those 3th-party dependencies.

Yes. I want to pull the third-party lib building out of build-installer.py into 
a simple separate build step, probably just using make, that can produce the 
minimum sets of third-party libs for use by both installer builds and by 
developers so that there is no dependency on other third-party distributors 
like Homebrew or MacPorts. With a little bit of care, it wouldn't have to be 
limited to just macOS builds.

--

___
Python tracker 

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



[issue45759] non-matching `elif`/`else` statements with uninformative errors

2021-11-08 Thread theeshallnotknowethme


theeshallnotknowethme  added the comment:

I'd like to expand this to more than just `elif`/`else statements inside `if` 
statement blocks and make an error for other cases as well. I currently have a 
PR that has a general error to accommodate those cases.

--
title: `elif` inside `if` block is a `SyntaxError` -> non-matching 
`elif`/`else` statements with uninformative errors

___
Python tracker 

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



[issue45748] "import ctypes" segfaults on Python 3.6 and Ubuntu 21.10

2021-11-08 Thread Ned Deily


Ned Deily  added the comment:

> Python 3.6 is in security-fix only mode.

And besides that, it's not clear what problem you are reporting without more 
context. As far as I can tell, neither the "good" nor the "bad" commit ids you 
reference are in or were backported to the 3.6 branch. Without more 
information, it is hard to speculate, however one thing that *might* be 
relevant is the version of libffi you are trying to use. There have been 
several issues reported against other branches of Python when trying to use 
libffi's recent 3.4.2 release. In any case, as Erlend noted, this doesn't 
appear to be a security-related issue; in general, changes for newer versions 
of operating systems or third-party libraries are out-of-scope for Python 
versions in the security-fix phase of their life cycles.

--
resolution:  -> wont fix
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



[issue45755] Mock spec with a specialized generic class does not mock class attributes

2021-11-08 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue45171] stacklevel handling in logging module is inconsistent

2021-11-08 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

The stacklevel arg was added 3+ years ago, wouldn't fixing this break a lot of 
code in a way that's hard to detect? That is to say, logs will look just fine, 
but when you try to debug an issue, you will realise it's pointing to an 
unhelpful location?

--
nosy: +andrei.avk

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-11-08 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Martin:

I have a couple of concerns:

 - Generally (AFAIK) Python is very conservative about silencing arbitrary 
exceptions. There are a few functions with args like `ignore_errors`, but those 
are for errors in the logic of respective functions. I don't recall examples 
where any error would be silenced via an argument, but if there are such cases, 
it would be interesting to look into how the design decision was made.

In this case of course arbitrary exceptions coming any objects' __repr__ may be 
silenced.

There is a clear and very explicit way to catch exceptions via try/except and 
as a dev, I would really want to be able to look at a module, look at all 
try/except clauses and be confident that exceptions are not silenced elsewhere.

 - You are targeting this fix to production use, but realistically, if merged, 
it will be used both in testing and production. Which means, by not seeing 
these exceptions in testing, you will have a higher chance of deploying them to 
production where they can surface in other circumstances.

IOW, as a dev I might prefer to see these errors early and often, rather than 
have a mechanism that ends up silencing errors more broadly than intended.

I'm not saying this fix should be rejected, but that there's a tricky balance 
here -- and I don't feel confident enough about this solution to approve the PR 
if I reviewed it.

--

___
Python tracker 

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



[issue45636] Merge BINARY_*/INPLACE_* into BINARY_OP/INPLACE_OP

2021-11-08 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +27733
pull_request: https://github.com/python/cpython/pull/29482

___
Python tracker 

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



[issue45760] Remove "PyNumber_InMatrixMultiply"

2021-11-08 Thread theeshallnotknowethme


theeshallnotknowethme  added the comment:

Also with this, could anyone also remove the unused `VISIT_SLICE` macro in 
'Python/compile.c'? Thanks.

--
nosy: +February291948

___
Python tracker 

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



[issue45760] Remove "PyNumber_InMatrixMultiply"

2021-11-08 Thread Brandt Bucher


New submission from Brandt Bucher :

Here's a weird one: for the last 8 years, we've defined a function called 
"PyNumber_InMatrixMultiply" in abstract.c. It's a pretty clear misspelling of 
"PyNumber_InPlaceMatrixMultiply", which is *also* defined in that file. There's 
no documentation or tests for it, which further suggests that its inclusion was 
a mistake.

Any new contributors interested in deleting that one line? :)

--
components: C API
keywords: easy (C)
messages: 405992
nosy: brandtbucher
priority: low
severity: normal
status: open
title: Remove "PyNumber_InMatrixMultiply"
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



[issue45759] `elif` inside `if` block is a `SyntaxError`

2021-11-08 Thread theeshallnotknowethme


Change by theeshallnotknowethme :


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

___
Python tracker 

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



[issue45757] dis module incorrectly handles EXTENDED_ARG + NOP sequence

2021-11-08 Thread Brandt Bucher


Brandt Bucher  added the comment:

I have a hunch that this is caused in optimize_basic_block. In general, we 
don't bother clearing the oparg when peepholing instructions into NOPs.

We could either start becoming more principled about that and fix all of the 
existing NOPs, or just update instrsize and write_op_arg to ignore args for 
instructions that don't use them.

The latter seems easier and less error-prone.

--
nosy: +brandtbucher

___
Python tracker 

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



[issue45759] `elif` inside `if` block is a `SyntaxError`

2021-11-08 Thread theeshallnotknowethme


New submission from theeshallnotknowethme :

While fixing errors in a program, I encountered this:

if a == b + 2:
c = sqrt(b) + a**2
elif a == b + 3:

SyntaxError: Invalid syntax

It should be giving an `IndentationError` or a better error message at least.

--
components: Parser
messages: 405990
nosy: February291948, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: `elif` inside `if` block is a `SyntaxError`
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue45757] dis module incorrectly handles EXTENDED_ARG + NOP sequence

2021-11-08 Thread Rok Mandeljc


Rok Mandeljc  added the comment:

The EXTENDED_ARG + NOP sequence seems to be specific to python 3.10; we could 
not reproduce the original bug (dis failing on telegram.message) with earlier 
python versions. The combination makes little sense, so perhaps it is a bug on 
its own?

--

___
Python tracker 

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



[issue45757] dis module incorrectly handles EXTENDED_ARG + NOP sequence

2021-11-08 Thread Irit Katriel


Irit Katriel  added the comment:

+ Mark for FYI. 

The behaviour of dis is not new, I wonder if generating code with EXTENDED_ARG 
+ NOP is new?

--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue45757] dis module incorrectly handles EXTENDED_ARG + NOP sequence

2021-11-08 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue45757] dis module incorrectly handles EXTENDED_ARG + NOP sequence

2021-11-08 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.11 -Python 3.8

___
Python tracker 

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



[issue45758] Crash on Py_DecRef'ing builtin object from previous run

2021-11-08 Thread Victor Milovanov


New submission from Victor Milovanov :

Trying to Py_DecRef owned reference to builtin "iter" crashes if the reference 
was alive when runtime was reinitialized.

Py_Initialize();
PyObject* builtins = PyEval_GetBuiltins();
PyObject* iter = PyDict_GetItemString(builtins, "iter");

Py_IncRef(iter);

Py_Finalize();

// - new run starts, iter should still be alive

Py_Initialize();

Py_DecRef(iter);

Py_Finalize(); // fails inside PyGC_Collect -> validate_list

Related on StackOverflow: 
https://stackoverflow.com/questions/69890182/is-it-safe-to-call-py-decref-on-an-object-created-before-the-last-py-initializ

--
components: C API
messages: 405987
nosy: Victor Milovanov
priority: normal
severity: normal
status: open
title: Crash on Py_DecRef'ing builtin object from previous run
type: crash
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue45757] dis module incorrectly handles EXTENDED_ARG + NOP sequence

2021-11-08 Thread Irit Katriel


Irit Katriel  added the comment:

Thanks for the report. This should fix it, I'll create a patch:

@@ -428,6 +428,7 @@ def _unpack_opargs(code):
 extended_arg = (arg << 8) if op == EXTENDED_ARG else 0
 else:
 arg = None
+extended_arg = 0
 yield (i, op, arg)

--
nosy: +iritkatriel, serhiy.storchaka

___
Python tracker 

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



[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2021-11-08 Thread Alex Waygood


Change by Alex Waygood :


--
pull_requests: +27730
pull_request: https://github.com/python/cpython/pull/29479

___
Python tracker 

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



[issue45757] dis module incorrectly handles EXTENDED_ARG + NOP sequence

2021-11-08 Thread Rok Mandeljc


New submission from Rok Mandeljc :

dis module incorrectly handles the instruction sequence where EXTENDED_ARG is 
followed by NOP, e.g.,:

EXTENDED_ARG 0x01
NOP
EXTENDED_ARG 0x01
LOAD_CONST 0x29

The above sequence loads the constant from index 0x0129, whereas dis attempts 
to load it from index 0x010129, resulting in "IndexError: tuple index out of 
range error" when attempting to iterate over instructions returned by 
dis.get_instructions().

Complete example:

# *** example.py begin ***
import types
import dis

# Create a test code object...
constants = [None] * (0x000129 + 1)
constants[0x000129] = "Hello world!"

code = types.CodeType(
0,  # argcount
0,  # posonlyargcount
0,  # kwonlyargcount
0,  # nlocals
1,  # stacksize
64,  # flags
bytes([
0x90, 0x01,  # EXTENDED_ARG 0x01
0x09, 0xFF,  # NOP 0xFF
0x90, 0x01,  # EXTENDED_ARG 0x01
0x64, 0x29,  # LOAD_CONST 0x29
0x53, 0x00,  # RETURN_VALUE 0x00
]),  # codestring=
tuple(constants),  # constants
(),  # names
(),  # varnames
'',  # filename
'code',  # name
1,  # firstlineno
b''  # linetable
)

# ... and eval it to show that NOP resets EXTENDED_ARG
print("Output:", eval(code))

# Try to list all instructions via dis
print(list(dis.get_instructions(code)))

# *** example.py end ***

Running the example gives us:

Output: Hello world!
Traceback (most recent call last):
  File "/home/rok/example.py", line 35, in 
print(list(dis.get_instructions(code)))
  File "/usr/lib64/python3.10/dis.py", line 338, in _get_instructions_bytes
argval, argrepr = _get_const_info(arg, constants)
  File "/usr/lib64/python3.10/dis.py", line 292, in _get_const_info
argval = const_list[const_index]
IndexError: tuple index out of range


To fix the problem on dis side, the extended_arg in dis._unpack_opargs should 
be reset to 0 when NOP (or perhaps any opcode without argument) is encountered. 
I.e., by adding "extended_arg = 0" here:
https://github.com/python/cpython/blob/91275207296c39e495fe118019a757c4ddefede8/Lib/dis.py#L525



The problematic behavior was reported by users of PyInstaller under python 
3.10; it seems that python 3.10 generates bytecode involving EXTENDED_ARG + NOP 
for telegram.message.py:
https://raw.githubusercontent.com/python-telegram-bot/python-telegram-bot/v13.7/telegram/message.py

The original PyInstaller issue with preliminary analysis is here: 
https://github.com/pyinstaller/pyinstaller/issues/6301

--
components: Library (Lib)
messages: 405985
nosy: rok.mandeljc
priority: normal
severity: normal
status: open
title: dis module incorrectly handles EXTENDED_ARG + NOP sequence
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

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



[issue33927] Allow json.tool to have identical infile and outfile

2021-11-08 Thread Chris Wesseling


Change by Chris Wesseling :


--
nosy: +CharString
nosy_count: 6.0 -> 7.0
pull_requests: +27728
pull_request: https://github.com/python/cpython/pull/29478

___
Python tracker 

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



[issue45644] Make json.tool soak up input before opening output for writing

2021-11-08 Thread Chris Wesseling


Change by Chris Wesseling :


--
pull_requests: +27729
pull_request: https://github.com/python/cpython/pull/29478

___
Python tracker 

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



[issue45732] Update python.org Windows and macOS installers to use Tk 8.6.12

2021-11-08 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue38006] Crash in remove() weak reference callback of weakref.WeakValueDictionary at Python exit

2021-11-08 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

Closing since I believe the bug is fixed and there is an appropriate unit test.

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



[issue42109] Use hypothesis for testing the standard library, falling back to stubs

2021-11-08 Thread Aaron Meurer


Change by Aaron Meurer :


--
nosy: +asmeurer

___
Python tracker 

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



[issue45754] [sqlite3] SQLITE_LIMIT_LENGTH is incorrectly used to check statement length

2021-11-08 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

I'm leaning towards alt 1. It is also easy to test all paths with that option. 
But I also think alt 3 is ok. It makes for easier code to maintain.

Alt 2 is, as you say, the weakest alternative.

> What happens if set SQLITE_LIMIT_SQL_LENGTH to 0 or negative value? Would it 
> be interpreted as "no limit"?

I'm not sure about 0; I'll try to find out.

If you supply -1, you are querying the limit category, not setting it.

--

___
Python tracker 

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



[issue45756] mock raises exception when using a spec with an attribute that raises exception on access

2021-11-08 Thread Kevin Jamieson


New submission from Kevin Jamieson :

In Python 3.8 and later creating a mock with a spec specifying an object 
containing a property that happens to raise an exception when accessed will 
fail, because _mock_add_spec calls getattr() on every attribute of the spec. 
This did not happen in Python 3.6/3.7.

This is likely a fairly unusual scenario (and in the particular case where I 
encountered this I could just use a class instead of an instance for the spec), 
but it was surprising.

For example:

# cat test.py
from unittest import mock

class Foo:
@property
def bar(self) -> str:
raise Exception('xxx')

m = mock.MagicMock(spec=Foo())

# python3.11 test.py
Traceback (most recent call last):
  File "/root/test.py", line 8, in 
m = mock.MagicMock(spec=Foo())
^^
  File "/usr/lib/python3.11/unittest/mock.py", line 2069, in __init__
_safe_super(MagicMixin, self).__init__(*args, **kw)
^^^
  File "/usr/lib/python3.11/unittest/mock.py", line 1087, in __init__
_safe_super(CallableMixin, self).__init__(
^^
  File "/usr/lib/python3.11/unittest/mock.py", line 442, in __init__
self._mock_add_spec(spec, spec_set, _spec_as_instance, _eat_self)
^
  File "/usr/lib/python3.11/unittest/mock.py", line 497, in _mock_add_spec
if iscoroutinefunction(getattr(spec, attr, None)):
   ^
  File "/root/test.py", line 6, in bar
raise Exception('xxx')
^^
Exception: xxx

--
messages: 405982
nosy: kjamieson
priority: normal
severity: normal
status: open
title: mock raises exception when using a spec with an attribute that raises 
exception on access
type: behavior
versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9

___
Python tracker 

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



[issue45755] Mock spec with a specialized generic class does not mock class attributes

2021-11-08 Thread Kevin Jamieson


New submission from Kevin Jamieson :

This worked in Python 3.6, but in Python 3.7 and later creating a mock with a 
spec specifying a subscripted generic class does not mock any of the attributes 
of the class, because those attributes are not returned by dir().

For example:

# cat test.py
from typing import Generic, TypeVar
from unittest import mock

T = TypeVar('T')

class Foo(Generic[T]):
def bar(self) -> None:
pass

m = mock.MagicMock(spec=Foo[int])
m.bar()


# python3.11 test.py
Traceback (most recent call last):
  File "/root/test.py", line 11, in 
m.bar()
^^^
  File "/usr/lib/python3.11/unittest/mock.py", line 635, in __getattr__
raise AttributeError("Mock object has no attribute %r" % name)
^^
AttributeError: Mock object has no attribute 'bar'

--
components: Library (Lib)
messages: 405981
nosy: kjamieson
priority: normal
severity: normal
status: open
title: Mock spec with a specialized generic class does not mock class attributes
type: behavior
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue38006] Crash in remove() weak reference callback of weakref.WeakValueDictionary at Python exit

2021-11-08 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Are we missing something here?

--

___
Python tracker 

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



[issue45754] [sqlite3] SQLITE_LIMIT_LENGTH is incorrectly used to check statement length

2021-11-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

In alternative 1 we control the type and the message of exception. In 
alternative 3 we left this to the SQLite3 engine. It is difficult to keep 
consistency in alternative 2, errors raised for sizes less and larger than 
INT_MAX can be different. I think this is a serious drawback of this 
alternative.

What happens if set SQLITE_LIMIT_SQL_LENGTH to 0 or negative value? Would it be 
interpreted as "no limit"?

--

___
Python tracker 

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



[issue2771] Test issue

2021-11-08 Thread Berker Peksag


Change by Berker Peksag :


--
nosy:  -berker.peksag

___
Python tracker 

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



[issue45723] Improve and simplify configure.ac checks

2021-11-08 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset cbab997efb3ba5123dc8d9f706184fa8e634b3ec by Christian Heimes in 
branch 'main':
bpo-45723: Prepare support for autoconf 2.71 (GH-29441)
https://github.com/python/cpython/commit/cbab997efb3ba5123dc8d9f706184fa8e634b3ec


--

___
Python tracker 

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



[issue45723] Improve and simplify configure.ac checks

2021-11-08 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 9bd0cf5970997b63d296e30d51e7bb9a15dcabaf by Erlend Egeberg 
Aasland in branch 'main':
bpo-45723: Add macro for disabling/enabling CC warnings (GH-29466)
https://github.com/python/cpython/commit/9bd0cf5970997b63d296e30d51e7bb9a15dcabaf


--

___
Python tracker 

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



[issue45754] [sqlite3] SQLITE_LIMIT_LENGTH is incorrectly used to check statement length

2021-11-08 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

In Modules/_sqlite/statement.c pysqlite_statement_create() and 
Modules/_sqlite/cursor.c pysqlite_cursor_executescript_impl(), we incorrectly 
use SQLITE_LIMIT_LENGTH to check statement length. However, the correct limit 
is *SQLITE_LIMIT_SQL_LENGTH*.

### Alternative 1:
Quick fix is to check against SQLITE_LIMIT_SQL_LENGTH instead of 
SQLITE_LIMIT_LENGTH.

### Alternative 2:
Let SQLite do the check for us, and instead add integer overflow check, since 
Py_ssize_t may be larger than int (sqlite3_prepare_v2() uses an int as the max 
statement length parameter).

### Alternative 3:
As alternative 2, but alter the sqlite3_prepare_v2() call to accept _any_ 
length (max statement length = -1).


See also:
- https://sqlite.org/limits.html
- https://sqlite.org/c3ref/c_limit_attached.html
- https://sqlite.org/c3ref/prepare.html

--
messages: 405975
nosy: erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [sqlite3] SQLITE_LIMIT_LENGTH is incorrectly used to check statement 
length

___
Python tracker 

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



[issue45754] [sqlite3] SQLITE_LIMIT_LENGTH is incorrectly used to check statement length

2021-11-08 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

BTW, this only affects the code in main.

--
components: +Extension Modules
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



[issue45732] Update python.org Windows and macOS installers to use Tk 8.6.12

2021-11-08 Thread Steve Dower


Steve Dower  added the comment:

I guess I've actually got to fix my build process now :)

--

___
Python tracker 

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



[issue45753] Further speed up Python-to-Python calls.

2021-11-08 Thread Mark Shannon


New submission from Mark Shannon :

There are three things we want to do:

1. Speed up pushing and popping frames. See 
https://github.com/faster-cpython/ideas/issues/111 for details.
2. Avoid tracing and other admin overhead on entering and leaving. See 
https://github.com/faster-cpython/ideas/issues/112.
3. Keep the remaining recursion depth in the cframe, to reduce the work for a 
recursion check from
`++tstate->recursion_depth > tstate->interp->ceval.recursion_limit`
to
`cframe.recursion_overhead-- > 0`

--
assignee: Mark.Shannon
components: Interpreter Core
messages: 405970
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Further speed up Python-to-Python calls.
type: performance
versions: Python 3.11

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-11-08 Thread STINNER Victor


STINNER Victor  added the comment:

greenlet now uses PyThreadState_EnterTracing() and PyThreadState_LeaveTracing() 
rather than accessing directly use_tracing:

https://github.com/python-greenlet/greenlet/commit/9b49da5c7e4808bd61b992e40f5b5243bfa9be6f

On Python 3.10, it implements these functions with:
---

// bpo-43760 added PyThreadState_EnterTracing() to Python 3.11.0a2
#if PY_VERSION_HEX < 0x030B00A2 && !defined(PYPY_VERSION)
static inline void PyThreadState_EnterTracing(PyThreadState *tstate)
{
tstate->tracing++;
#if PY_VERSION_HEX >= 0x030A00A1
tstate->cframe->use_tracing = 0;
#else
tstate->use_tracing = 0;
#endif
}
#endif

// bpo-43760 added PyThreadState_LeaveTracing() to Python 3.11.0a2
#if PY_VERSION_HEX < 0x030B00A2 && !defined(PYPY_VERSION)
static inline void PyThreadState_LeaveTracing(PyThreadState *tstate)
{
tstate->tracing--;
int use_tracing = (tstate->c_tracefunc != NULL
   || tstate->c_profilefunc != NULL);
#if PY_VERSION_HEX >= 0x030A00A1
tstate->cframe->use_tracing = use_tracing;
#else
tstate->use_tracing = use_tracing;
#endif
}
#endif
---

This code was copied from my https://github.com/pythoncapi/pythoncapi_compat 
project. (I wrote the greenlet change.)

--

___
Python tracker 

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



[issue45712] Typo in "control flow" documentation

2021-11-08 Thread miss-islington


miss-islington  added the comment:


New changeset 2c4792264f9218692a1bd87398a60591f756b171 by Miss Islington (bot) 
in branch '3.10':
Closes bpo-45712: Add missing word in control flow tutorial (GH-29460)
https://github.com/python/cpython/commit/2c4792264f9218692a1bd87398a60591f756b171


--

___
Python tracker 

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2021-11-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 80580f5ab85e3c45c8c5e863a891598d10bf by Miss Islington (bot) 
in branch '3.9':
bpo-40170: Update What's New in Python 3.9 (GH-29470) (GH-29472)
https://github.com/python/cpython/commit/80580f5ab85e3c45c8c5e863a891598d10bf


--

___
Python tracker 

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



[issue45688] stdlib_module_names.h is missing _scproxy

2021-11-08 Thread STINNER Victor


STINNER Victor  added the comment:

On Python 3.11.0a2+, I now get:

$ ./python -c 'import sys; print(len(sys.stdlib_module_names))'
304

One more module ;-)

--

___
Python tracker 

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2021-11-08 Thread miss-islington


miss-islington  added the comment:


New changeset 69b3de65adc691cc5ad66e70e5c7caf61c202c79 by Miss Islington (bot) 
in branch '3.10':
bpo-40170: Update What's New in Python 3.9 (GH-29470)
https://github.com/python/cpython/commit/69b3de65adc691cc5ad66e70e5c7caf61c202c79


--

___
Python tracker 

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



[issue45688] stdlib_module_names.h is missing _scproxy

2021-11-08 Thread STINNER Victor


STINNER Victor  added the comment:

Oh right, Tools/scripts/generate_stdlib_module_names.py runs "./python setup.py 
-q build --list-module-names" which skips modules which are only built on 
specific platforms. On the Python CI, generate_stdlib_module_names.py is run on 
Linux.

Nicely spotted, and thanks for the fix!

Oh, it's hard to really know what the "stdlib" contains ;-)

--

___
Python tracker 

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



[issue13703] Hash collision security issue

2021-11-08 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



[issue17239] XML vulnerabilities in Python

2021-11-08 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



[issue45319] Possible regression in __annotations__ descr for heap type subclasses

2021-11-08 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



[issue45752] copy module doc wrongly says it doesn't copy arrays

2021-11-08 Thread Stefan Pochmann


New submission from Stefan Pochmann :

The doc https://docs.python.org/3/library/copy.html says:

"This module does not copy types like module, method, stack trace, stack frame, 
file, socket, window, array, or any similar types."

But it does copy arrays just fine:

import copy, array
a = array.array('i', [1, 2])
b = copy.copy(a)
a[0] = 3
print(a)
print(b)

Output:

array('i', [3, 2])
array('i', [1, 2])

--
assignee: docs@python
components: Documentation
messages: 405962
nosy: Stefan Pochmann, docs@python
priority: normal
severity: normal
status: open
title: copy module doc wrongly says it doesn't copy arrays
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

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



[issue45712] Typo in "control flow" documentation

2021-11-08 Thread Zachary Ware


Zachary Ware  added the comment:


New changeset 7484a5c82a2dfc106bb1e4b060cad2df00521bfd by 180909 in branch 
'main':
Closes bpo-45712: Add missing word in control flow tutorial (GH-29460)
https://github.com/python/cpython/commit/7484a5c82a2dfc106bb1e4b060cad2df00521bfd


--
nosy: +zach.ware
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



[issue45712] Typo in "control flow" documentation

2021-11-08 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +27726
pull_request: https://github.com/python/cpython/pull/29473

___
Python tracker 

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



[issue22097] Linked list API for ordereddict

2021-11-08 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



[issue45751] "SyntaxError: 'await' outside function" in "asyncio-task.html#waiting-primitives" code snippets

2021-11-08 Thread Jose Ville


New submission from Jose Ville :

https://docs.python.org/3/library/asyncio-task.html#asyncio.wait has the 
following two code snippets both of which fail with ""SyntaxError: 'await' 
outside function" when I run them in Python 3.9.7

Snippet 1:

```
async def foo():
return 42

coro = foo()
done, pending = await asyncio.wait({coro})

if coro in done:
# This branch will never be run!
pass # I added this to prevent IndentationError
```

Snippet 2:

```
async def foo():
return 42

task = asyncio.create_task(foo())
done, pending = await asyncio.wait({task})

if task in done:
# Everything will work as expected now.
pass # I added this to prevent IndentationError
```

--
components: asyncio
messages: 405960
nosy: asvetlov, joseville, yselivanov
priority: normal
severity: normal
status: open
title: "SyntaxError: 'await' outside function" in 
"asyncio-task.html#waiting-primitives" code snippets
type: compile error
versions: Python 3.9

___
Python tracker 

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



[issue45436] test_tk.test_configure_type() fails with Tcl/Tk 8.6.11

2021-11-08 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



[issue2771] Test issue

2021-11-08 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



[issue42967] [CVE-2021-23336] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-11-08 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



[issue45750] "SyntaxError: 'await' outside function" in "asyncio-task.html#waiting-primitives" code snippets

2021-11-08 Thread Jose Ville


New submission from Jose Ville :

https://docs.python.org/3/library/asyncio-task.html#asyncio.wait has the 
following two code snippets both of which fail with ""SyntaxError: 'await' 
outside function" when I run them in Python 3.9.7

Snippet 1:

```
async def foo():
return 42

coro = foo()
done, pending = await asyncio.wait({coro})

if coro in done:
# This branch will never be run!
pass # I added this to prevent IndentationError
```

Snippet 2:

```
async def foo():
return 42

task = asyncio.create_task(foo())
done, pending = await asyncio.wait({task})

if task in done:
# Everything will work as expected now.
pass # I added this to prevent IndentationError
```

--
components: asyncio
messages: 405958
nosy: asvetlov, joseville, yselivanov
priority: normal
severity: normal
status: open
title: "SyntaxError: 'await' outside function" in 
"asyncio-task.html#waiting-primitives" code snippets
type: compile error
versions: Python 3.9

___
Python tracker 

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



[issue45749] Silently fails to build hashlib if openssl has disabled algorithms

2021-11-08 Thread Christian Heimes


Christian Heimes  added the comment:

Out of curiosity, which vendor / platform provides OpenSSL builds without 
scrypt?

--

___
Python tracker 

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



[issue45749] Silently fails to build hashlib if openssl has disabled algorithms

2021-11-08 Thread Ross Burton


Ross Burton  added the comment:

Cool, glad to see the additional checks.

--

___
Python tracker 

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2021-11-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27724
pull_request: https://github.com/python/cpython/pull/29471

___
Python tracker 

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2021-11-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27725
pull_request: https://github.com/python/cpython/pull/29472

___
Python tracker 

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2021-11-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 99c7e9853fa13af414168f179213e3d2fae03a45 by Victor Stinner in 
branch 'main':
bpo-40170: Update What's New in Python 3.9 (GH-29470)
https://github.com/python/cpython/commit/99c7e9853fa13af414168f179213e3d2fae03a45


--

___
Python tracker 

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



[issue45749] Silently fails to build hashlib if openssl has disabled algorithms

2021-11-08 Thread Christian Heimes


Christian Heimes  added the comment:

This is by design. As of PEP 644, Python 3.10 requires a full OpenSSL 1.1.1 
build. See bpo-45627 for a discussion why we need a full build.

Traditionally we also don't fail the entire build if one or more optional 
modules fail to build. You only get error output on stdout/stderr. Python 
3.10.1 will perform additional checks in the configure step, see bpo-45536.

--
nosy: +christian.heimes
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
superseder:  -> OpenSSL 1.1.1 still implements some disable-flags for Blake2, 
Scrypt

___
Python tracker 

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



[issue45749] Silently fails to build hashlib if openssl has disabled algorithms

2021-11-08 Thread Ross Burton


Change by Ross Burton :


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



[issue45749] Silently fails to build hashlib if openssl has disabled algorithms

2021-11-08 Thread Ross Burton


New submission from Ross Burton :

If my openssl is built with no-scrypt then the Python build of hashlib fails 
(as EVP_PBE_scrypt isn't present), but the overall compile succeeds.

--
components: Build
messages: 405954
nosy: rossburton2
priority: normal
severity: normal
status: open
title: Silently fails to build hashlib if openssl has disabled algorithms

___
Python tracker 

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2021-11-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27723
pull_request: https://github.com/python/cpython/pull/29470

___
Python tracker 

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



[issue45747] Detect dbm and gdbm dependencies in configure.ac

2021-11-08 Thread Christian Heimes


Christian Heimes  added the comment:

Thanks Ronald. I was not aware that macOS has dbm_open in libc.

AC_CHECK_LIB() always tries to link with an external library. The macro should 
skip the symbol from libc. Could you please run the PR locally and upload your 
config.log?

--

___
Python tracker 

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



[issue45748] "import ctypes" segfaults on Python 3.6 and Ubuntu 21.10

2021-11-08 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +ned.deily -serhiy.storchaka
status: pending -> open

___
Python tracker 

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



[issue45748] "import ctypes" segfaults on Python 3.6 and Ubuntu 21.10

2021-11-08 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Python 3.6 is in security-fix only mode. I'm sorry, but I don't think this 
counts as a security issue.

--
nosy: +erlendaasland
status: open -> pending

___
Python tracker 

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



[issue45748] "import ctypes" segfaults on Python 3.6 and Ubuntu 21.10

2021-11-08 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue23041] csv needs more quoting rules

2021-11-08 Thread Skip Montanaro


Skip Montanaro  added the comment:

Note to @samwyse and @krypten: I updated the patches and created a pull request 
on GitHub, but I have no way of knowing if at least krypten has signed a CLA 
for Python. Since you're the author of the original patches, we need to verify 
that you have.

--

___
Python tracker 

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



[issue23041] csv needs more quoting rules

2021-11-08 Thread Skip Montanaro


Change by Skip Montanaro :


--
pull_requests: +27722
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/29469

___
Python tracker 

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



[issue45748] "import ctypes" segfaults on Python 3.6 and Ubuntu 21.10

2021-11-08 Thread Thomas Trummer


New submission from Thomas Trummer :

3.7 and later are all working fine.

First good commit: 55fe1ae9708d81b902b6fe8f6590e2a24b1bd4b0
First bad commit: fdbd01151dbd5feea3e4c0316d102db3d2a2a412


git checkout v3.6.15

#0  0x76cc52a0 in PyCFuncPtr_new (type=0x559157f8, 
args=0x76ce6dd8, kwds=0x0)

at /home/tom/pydev/cpython/Modules/_ctypes/_ctypes.c:3557

#1  0x556400f9 in type_call (type=0x559157f8, args=0x76ce6dd8, 
kwds=0x0) at Objects/typeobject.c:895

#2  0x555db4ca in _PyObject_FastCallDict (func=0x559157f8, 
args=0x76dc1f48, nargs=1, kwargs=0x0) at Objects/abstract.c:2331

#3  0x556b8e7c in call_function 
(pp_stack=pp_stack@entry=0x7fffcb58, oparg=, 
kwnames=kwnames@entry=0x0)

at Python/ceval.c:4875

#4  0x556bc9d3 in _PyEval_EvalFrameDefault (f=, 
throwflag=) at Python/ceval.c:3335

#5  0x556b774c in PyEval_EvalFrameEx (throwflag=0, f=0x76dc1dc8) at 
Python/ceval.c:754

#6  _PyFunction_FastCall (co=, args=, 
nargs=nargs@entry=0, globals=) at Python/ceval.c:4933

#7  0x556b9269 in fast_function (kwnames=0x0, nargs=0, stack=, func=0x76d78378) at Python/ceval.c:4968

#8  call_function (pp_stack=pp_stack@entry=0x7fffccf8, oparg=, kwnames=kwnames@entry=0x0) at Python/ceval.c:4872

#9  0x556bc9d3 in _PyEval_EvalFrameDefault (f=, 
throwflag=) at Python/ceval.c:3335

#10 0x556b83c7 in PyEval_EvalFrameEx (throwflag=0, f=0x558d2248) at 
Python/ceval.c:754

#11 _PyEval_EvalCodeWithName (_co=_co@entry=0x76cdf660, 
globals=globals@entry=0x76dfa438, locals=locals@entry=0x76dfa438, 

args=args@entry=0x0, argcount=argcount@entry=0, kwnames=kwnames@entry=0x0, 
kwargs=0x0, kwcount=0, defs=0x0, defcount=0, kwdefs=0x0, 

closure=0x0, name=0x0, qualname=0x0, kwstep=2) at Python/ceval.c:4166

#12 0x556b9a25 in PyEval_EvalCodeEx (closure=0x0, kwdefs=0x0, 
defcount=0, defs=0x0, kwcount=0, kws=0x0, argcount=0, args=0x0, 

locals=0x76dfa438, globals=0x76dfa438, _co=0x76cdf660) at 
Python/ceval.c:4187

#13 PyEval_EvalCode (co=co@entry=0x76cdf660, 
globals=globals@entry=0x76dfa438, locals=locals@entry=0x76dfa438)

at Python/ceval.c:731

#14 0x556b611d in builtin_exec_impl (module=, 
locals=0x76dfa438, globals=0x76dfa438, source=0x76cdf660)

at Python/bltinmodule.c:983

#15 builtin_exec (module=, args=) at 
Python/clinic/bltinmodule.c.h:283

#16 0x5562b651 in PyCFunction_Call (func=func@entry=0x76eb7990, 
args=args@entry=0x76cdcd08, kwds=kwds@entry=0x76d6b288)

at Objects/methodobject.c:126

#17 0x556c11af in do_call_core (kwdict=0x76d6b288, 
callargs=0x76cdcd08, func=0x76eb7990) at Python/ceval.c:5116

#18 _PyEval_EvalFrameDefault (f=, throwflag=) at 
Python/ceval.c:3404

#19 0x556b8d17 in PyEval_EvalFrameEx (throwflag=0, f=0x76dc2930) at 
Python/ceval.c:754

#20 _PyEval_EvalCodeWithName (_co=0x76eabdb0, globals=, 
locals=, args=, argcount=3, 

kwnames=0x0, kwargs=0x76d913c8, kwcount=0, kwstep=1, defs=0x0, 
defcount=0, kwdefs=0x0, closure=0x0, name=0x76e53ad0, 

qualname=0x76e53ad0) at Python/ceval.c:4166

--
components: ctypes
messages: 405950
nosy: Thomas Trummer
priority: normal
severity: normal
status: open
title: "import ctypes" segfaults on Python 3.6 and Ubuntu 21.10
versions: Python 3.6

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-11-08 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Unless I am missing something it should be 3.11 non-silent warning and 3.12 
syntax error

--

___
Python tracker 

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



[issue44439] stdlib wrongly uses len() for bytes-like object

2021-11-08 Thread Ma Lin


Ma Lin  added the comment:

Serhiy Storchaka:

Sorry, I found `zipfile` module also has this bug, fixed in PR29468.

This bug was reported & fixed by GitHub user `marcoffee` firstly, so I list him 
as a co-author, his work:
https://github.com/animalize/pyzstd/issues/4

The second commit fixes an omission of issue41735, a very simple fix, I fix it 
in PR29468 by the way.

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

___
Python tracker 

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



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-08 Thread Skip Montanaro


Skip Montanaro  added the comment:

Thanks, I get that. My issue is with the apparent mismatch between the English 
meaning of "find leaks" and "fail env changed." It seems to me that the help 
message(s) for one or both of those options is probably incorrect and needs to 
be changed.

--

___
Python tracker 

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



[issue45747] Detect dbm and gdbm dependencies in configure.ac

2021-11-08 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

dbm_open is in libc on macOS. likely due to being in SUSv2.

The implementation in libc appears to be suboptimal (for example: issue33074), 
although I wouldn't teach configure.ac to ignore the system version of the 
library.

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue44439] stdlib wrongly uses len() for bytes-like object

2021-11-08 Thread Ma Lin


Change by Ma Lin :


--
pull_requests: +27721
pull_request: https://github.com/python/cpython/pull/29468

___
Python tracker 

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



[issue21644] Optimize bytearray(int) constructor to use calloc()

2021-11-08 Thread STINNER Victor


STINNER Victor  added the comment:

I abandonned the issue because I didn't have time to work on it. If you want, 
you can open a new issue for that.

--

___
Python tracker 

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



[issue45743] Cleanup and simplify setup.py

2021-11-08 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> 1) __APPLE_USE_RFC_3542 should have been in socketmodule.c from the start, 
> not sure why it was added in setup.py.

FTR, it was added by me in bpo-35569, GH-19526. I moved the check to setup.py 
because Ned made me do it :P 
https://github.com/python/cpython/pull/19526#discussion_r415637170

--

___
Python tracker 

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



[issue45743] Cleanup and simplify setup.py

2021-11-08 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

1) __APPLE_USE_RFC_3542 should have been in socketmodule.c from the start, not 
sure why it was added in setup.py.

2) as you and Ned noticed -search_paths_first has been the default for a long 
while, we can just drop it and anyone building on ancient systems can add the 
flag to CFLAGs/LDFLAGS as needed.  IIRC we added the flag to be able to build 
with local copies of libraries also shipped in the OS, in particular when using 
static libraries for those local copies.

3) I don't know about detect_dbm_gdbm, and don't use those libraries myself. It 
would be nice to be able to open system files created using dbopen etc, but on 
the other hand there is at least one bug report complaining about data 
corruption when using one o the dbm extensions linked with the system version 
of the library.

4/5) Fine by me, although I'm slightly worried about using pkg-config because 
the system doesn't ship that tool. 

Something you don't mention is the logic dealing with SDK roots. I haven't 
checked yet if similar logic would be necessary in configure. With some luck it 
isn't, but that depends on what's supported by autoconf and the particular 
probes we want to use.

@Ned: Not being able to use system versions of libraries is a bit annoying, but 
that's something you already have to do due to openssl.  Maybe we should also 
try to clean up and refactor the build-installer.py script to do have a way to 
build/install those 3th-party dependencies.

--

___
Python tracker 

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



[issue45743] Cleanup and simplify setup.py

2021-11-08 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 24af9a40a8f85af813ea89998aa4e931fcc78cd9 by Christian Heimes in 
branch 'main':
bpo-45743: Move __APPLE_USE_RFC_3542 into socketmodule.c (GH-29456)
https://github.com/python/cpython/commit/24af9a40a8f85af813ea89998aa4e931fcc78cd9


--

___
Python tracker 

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



[issue45747] Detect dbm and gdbm dependencies in configure.ac

2021-11-08 Thread Christian Heimes


Christian Heimes  added the comment:

Pablo's macOS ARM64 buildbot does not find libdb-5.3 although it has db.h: 
https://buildbot.python.org/all/#/builders/721/builds/97/steps/2/logs/stdio

macOS X86-64 buildbot has libdb-5.3: 
https://buildbot.python.org/all/#/builders/311/builds/332/steps/2/logs/stdio

--
nosy: +pablogsal

___
Python tracker 

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



[issue45747] Detect dbm and gdbm dependencies in configure.ac

2021-11-08 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue45747] Detect dbm and gdbm dependencies in configure.ac

2021-11-08 Thread Christian Heimes


New submission from Christian Heimes :

setup.py jumps through hoops to detect gdbm, gdbm_compat, ndbm, and bdb (libdb) 
build dependencies. I propose to simplify our support matrix and detect all 
dependencies in configure.ac.

gdbmmodule.c uses gdbm_open() API, which is provided by gdbm.h and libgdbm

dbmmodule.c uses the dbm_open() API, which can be provided by a combination of 
headers and shared libraries.

- gdbm/ndbm.h with libgdbm_compat
- gdbm-ndbm.h with libgdbm_compat
- ndbm.h with libgdbm_compat
- ndbm.h with libndbm
- db.h with libdb (lib-5.3 for over a decade)

setup.py makes some wrong assumption in regards of libgdbm. The shared library 
libgdbm does not provide the dbm_open() API on any system I tested. 
libgdbm_compat is always required. Linking with libgdbm is not needed. 
libgdbm_compat depends on and wraps libgdbm.

setup.py also performs additional steps to locate old versions of libdb-3.x and 
libdb-4.x. libdb-5.3 has been around for a decade. Even CentOS 7 and Debian 
oldoldstable ship with libdb version 5.3 and don't offer libdb version 4. I 
propose to remove support for libdb 4 and libdb 3.

--
assignee: christian.heimes
components: Build
messages: 405940
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: Detect dbm and gdbm dependencies in configure.ac
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-11-08 Thread Guido van Rossum


Guido van Rossum  added the comment:

Do we have a plan for when this will be turned into a non-silent warning and 
when into an error?

--

___
Python tracker 

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



[issue45689] Add the ability to give custom names to threads created by ThreadPoolExecutor

2021-11-08 Thread Mark Dickinson


Mark Dickinson  added the comment:

> previously one could write .submit(function_name, *args, **kwargs)
> but now one should write 
> .submit(function_name, name_of_thread, *args, **kwargs)
> name_of_thread can be None

This approach can't work, I'm afraid: it would be a backwards-incompatible 
change to the `submit` method signature, and would break many existing uses of 
submit.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue45723] Improve and simplify configure.ac checks

2021-11-08 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +27719
pull_request: https://github.com/python/cpython/pull/29466

___
Python tracker 

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



[issue45723] Improve and simplify configure.ac checks

2021-11-08 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue45644] Make json.tool soak up input before opening output for writing

2021-11-08 Thread Chris Wesseling


Chris Wesseling  added the comment:

@Remi

I left the current behaviour for --json-lines untouched, on purpose.
My reasoning was that the json-lines format is often seen in JSON streaming, 
and I didn't want to break the case where the input is an endless stream from 
stdin or a named pipe. And to keep the patch simple with minimal change to the 
exposed interface.

Simplest fix for the case in this current code would be: iff infile equals 
outfile (minding their types), call list(objs) on the generator[1] to 
materialise it in one go. The only case where that would break would be when 
infile == outfile and is a named pipe, but I can't imagine why I would want to 
both read and write to the same FIFO, other than comedic effect.

  [1] 
https://github.com/python/cpython/blob/122ca4d73faba279a579aa2011fa34661ce537a2/Lib/json/tool.py#L65

--

___
Python tracker 

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



[issue45689] Add the ability to give custom names to threads created by ThreadPoolExecutor

2021-11-08 Thread Alex Waygood


Change by Alex Waygood :


--
title: Custom Name for ThreadPoolExecutor -> Add the ability to give custom 
names to threads created by ThreadPoolExecutor

___
Python tracker 

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



[issue45512] [sqlite3] simplify "isolation level"

2021-11-08 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

IMO, GH-29053 improves readability, mainly because of these factors:

- Argument Clinic now takes care of the ref count dance, and as a bonus, it is 
more self-documenting (stating clearly that it accepts str and None)
- Begin statement validation has been refactored out, which IMO helps 
understanding how isolation level and begin statement is related
- The isolation level setter is now greatly simplified; it fits well in a 
screenful, there are fewer ref count dances
- Using get_begin_statement() is much less noisier than the previous string 
compare code in pysqlite_connection_set_isolation_level()


The only thing that still bugs me is the "magical" 6 byte offset needed to 
convert between isolation level and begin statement. Perhaps a set of 
conversion functions would make it more readable.

--

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-11-08 Thread Martin


Martin  added the comment:

I see two scenarious discussed here:

Scenario 1 (Offline / Batch-Mode):
A system runs user-supplied jobs that may fail. In the case of an error, the 
system shouldn't crash but rather store a maximally helpful message and carry 
on with the next job. Most likely, the relevant information is the situation 
that lead to the error in the first place, not that repr() has also gone wrong 
as a result.

This could be a a system to automatically test the homework code of your 
students. Or, like in my case, a framework that runs experiments. You would 
very likely want a system that does not crash if a __repr__ is wrongly 
implemented but prints a readable traceback and carries on with the next job.

Here, format_locals could be used to fall back to a different representation of 
an object if repr() fails.

This is the use case that my pull request tries to address primarily.

Scenario 2 (Online / Write, Test, Repeat):
A user frequently rewrites and executes their code until the desired outcome 
appears.
Errors inevitably happen. In this case, a maximally helpful stack trace is 
needed. Again, the relevant information is the situation that lead to the error 
in the first place, not that repr() has also gone wrong as a result.

Yes, it would be hard for unexperienced users to come up with 
StackSummary.extract(format_locals=...) by themselves.
But, the correct way would be to use a debugger anyway, not some hand-written 
code to print exceptions on the fly.

However, if your students receive a template file where they fill in missing 
function bodies etc, there might already be a substantial amount of code which 
they don't understand at first, nor do they need to care. Therefore, a piece of 
code that formats exceptions nicely would hurt here.

I think the most useful change for Scenario 2 (if, for some reason, a proper 
debugger is not an option) could be to add a command line option (e.g. -X 
capture_locals) so that a complete stack trace is printed if an exception 
bubbles up to interpreter level. (Here, it wouldn't hurt to handle exceptions 
in repr() because the interpreter already stopped exection anyway.)
This option would be very easy to teach to inexperienced users.

My pull request would provide preparation for this more extensive change.

--

___
Python tracker 

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



[issue45743] Cleanup and simplify setup.py

2021-11-08 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27718
pull_request: https://github.com/python/cpython/pull/29464

___
Python tracker 

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