[issue42979] _zoneinfo: zoneinfomodule_exec() doesn't check for PyDateTime_IMPORT failure

2021-01-23 Thread hai shi


hai shi  added the comment:

> If PyCapsule_Import() fails, zoneinfomodule_exec() returns 0 (success) with 
> an exception raised.

Why not return -1 directly when PyCapsule_Import() fails?
It looks like more simpler. Do I miss something?

--
nosy: +shihai1991

___
Python tracker 

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



[issue43013] IDLE: update code, mostly by cleanups of 2.x or 2to3 artifacts

2021-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

5. Extraneous () after class name in class header: 'class name():'.  Never done 
in idlelib itself, 27 in test files, mostly in 1 file.

--

___
Python tracker 

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



[issue42948] bytearray.copy is undocumented

2021-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Josh, you are right.  I closed the PR.  Before closing, I will think about 
whether to propose a change to make this more prominent.

I notice the issubclass(array.array, collections.abc.MutableSequence ) is True 
even though some of the methods  (like clear, copy) are missing.

--

___
Python tracker 

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



[issue42948] bytearray.copy is undocumented

2021-01-23 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

Does this need specific documentation? bytearray itself is documented with:

> As bytearray objects are mutable, they support the mutable sequence 
> operations in addition to the common bytes and bytearray operations described 
> in Bytes and Bytearray Operations.

where "mutable" is a link to all the mutable sequence operations ( 
https://docs.python.org/3/library/stdtypes.html#typesseq-mutable ), including 
copy. Specifically documenting copy for bytearray is pointless; are we going to 
add specific documentation for append and remove and all the other mutable 
sequence operations as well?

--
nosy: +josh.r

___
Python tracker 

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



[issue43007] set_wakeup_fd() only works in main thread

2021-01-23 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +gvanrossum

___
Python tracker 

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



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

2021-01-23 Thread Éric Araujo

Éric Araujo  added the comment:

The difference is that semicolon is defined in a previous specification.

I don’t see this change as providing support for custom delimiters in URL 
parsing, but offering an option to pick between two specifications.

--

___
Python tracker 

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



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

2021-01-23 Thread Adam Goldschmidt

Adam Goldschmidt  added the comment:

> That doesn’t feel necessary to me.   I suspect most links use &, some use ;, 
> nothing else is valid at the moment and I don’t expect a new separator to 
> suddenly appear.  IMO the boolean parameter to also recognize ; was better.

That's reasonable. However, I think that we are making this change in order to 
treat the semicolon as a "custom" separator. In that case, why not let the 
developer decide on a different custom separator for their own use cases? 
What's the difference between a semicolon and something else?

--

___
Python tracker 

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



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

2021-01-23 Thread Adam Goldschmidt


Adam Goldschmidt  added the comment:

> I _didn't_ change the default - it will allow both '&' and ';' still. Eric 
> showed a link above that still uses semicolon. So I feel that it's strange to 
> break backwards compatibility in a patch update. Maybe we can make just '&' 
> the default in Python 3.10, while backporting the ability to specify 
> separators to older versions so it's up to users?

I like this implementation. I definitely think we should not break backwards 
compatibility and only change the default in Python 3.10.

--

___
Python tracker 

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



[issue43013] IDLE: update code, mostly by cleanups of 2.x or 2to3 artifacts

2021-01-23 Thread Terry J. Reedy


New submission from Terry J. Reedy :

Tal, just so you know in case you see a resulting merge conflict.  I've been 
waiting for years to do these until most PRs were closed.  Has not happened, 
and annoyances continue.

Since there is no search option I can find to search for PRs with a merge 
conflict, I assume that they are not discovered until a PR is accessed.  So 
when some of these are done, I will search with 'idle in:title', open, scroll 
down, and fix.

1. 9 leftover 'object's from 2.x "class C(object):" headers.

2. 6 unneeded 'list's added by 2to3 to make 'for item in list(iterable):'.

3. import 3.x-tkinter name as 2.x-tkinter; needs some care but fixes will be 
easy to verify.

4. builtin names like 'object', 'dict', and 'type' used as parameter names; I 
am open to opinion of adding '_' versus abbreviating versus alternative.  

5. ??

--
assignee: terry.reedy
components: IDLE
messages: 385564
nosy: taleinat, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE:  update code, mostly by cleanups of 2.x or 2to3 artifacts
type: enhancement
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



[issue40745] Typo in library/typing

2021-01-23 Thread Irit Katriel


Change by Irit Katriel :


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



[issue42948] bytearray.copy is undocumented

2021-01-23 Thread Patrick Haller


Patrick Haller  added the comment:

Terry, I am sorry. You are of course right. I was somehow looking at count not 
copy.

--

___
Python tracker 

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



[issue43003] Parts of the API will be removed in Python 4.0 ?

2021-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Questions should be asked on Q forums, like python_list.
Check Removed section of What's New in 3.10.
https://docs.python.org/3.10/whatsnew/3.10.html#removed

--
nosy: +terry.reedy
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue43008] IDLE ignores sys.excepthook in normal, subprocess mode

2021-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Ken, I read on another issue that an exception in an except suite is 
automatically linked to the caught exception, though the printed result may not 
be exactly the same.  Once your CLA is 'activated', I will experiment with the 
options.

--

___
Python tracker 

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



[issue43008] IDLE ignores sys.excepthook in normal, subprocess mode

2021-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Andre: with this patch, you could potentially add a function or submodule that 
would point sys.excepthook to a function that would print the exception and 
then interact before returning.  If this worked, one could add, for instance, 
'import friendly_traceback.idle' at the top of a file or at a Shell prompt and 
have friendly-traceback only activate when there is an exception.  So it would 
work in Shell.

I hope by 3.10 to have IDLE '>>>' prompts moved into a sidebar (instead of line 
numbers.  F-T prompts would be distinctly different.

--

___
Python tracker 

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



[issue43001] python3.9.1 test_embed test_tabnanny failed

2021-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

What system, what errors (copy-paste failure blocks)?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue42948] bytearray.copy is undocumented

2021-01-23 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Patrick, I am not sure what you are saying.  All the methods listed is this 
section are for both, as with

bytes.count(sub[, start[, end]])
bytearray.count(sub[, start[, end]])¶

but only bytearray has .copy (since there is never a need to copy an 
immutable).  This appears to be only methods like this.  PR created.

--
stage: patch review -> 
type: enhancement -> behavior
versions:  -Python 3.6, Python 3.7

___
Python tracker 

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



[issue42300] Typo in translation to portuguese

2021-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

This was fixed here: 
https://github.com/python/python-docs-pt-br/commit/9c1465ae8a93a2e1814618993fbe32a4078bd23e

--
nosy: +iritkatriel
resolution:  -> fixed
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



[issue43012] Remove pathlib accessors

2021-01-23 Thread Barney Gale

New submission from Barney Gale :

Per Pitrou:

> The original intent for the “accessor” thing was to have a variant that did 
> all accesses under a filesystem tree in a race condition-free way using 
> openat and friends. It turned out to be much too hairy to actually implement, 
> so was entirely abandoned, but the accessor abstraction was left there.

https://discuss.python.org/t/make-pathlib-extensible/3428/2

Accessors are:

- Lacking any internal purpose - '_NormalAccessor' is the only implementation
- Lacking any firm conceptual difference to `Path` objects themselves (inc. 
subclasses)
- Non-public, i.e. underscore prefixed - '_Accessor' and '_NormalAccessor' 
- Unofficially used to implement customized `Path` objects, but once once 
bpo-24132 lands there will be a supported route for that.

When bpo-24132 lands, I think we're free to remove accessors and simplify some 
code

--
components: Library (Lib)
messages: 385556
nosy: barneygale
priority: normal
severity: normal
status: open
title: Remove pathlib accessors

___
Python tracker 

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



[issue42992] Tkinter bbox coordinates incorrectly drawn

2021-01-23 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue42977] Tkinter Optionmenu Too Narrow on Mac

2021-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This should likely be closed as 3rd party

 zjdavid Which python release, which macOS, which installer, which tk 
patchlevel?  (IDLE Help=>About displays it).

At least one of the 3.9.1 python.org mac installers installs 8.6.10.  We cannot 
be responsible for problems fixed in this release.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue43006] Changed behaviour of inspect.signature() in Python 3.10

2021-01-23 Thread Guido van Rossum


Guido van Rossum  added the comment:

Note that this may be solved in a different way *if* PEP 649 is accepted. This 
was discussed extensively on python-dev last week. It would roll back the 
stringification of PEP 563 (unless `from __future__ import annotations` is 
used, which would be deprecated).

--
nosy: +larry

___
Python tracker 

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



[issue42974] tokenize reports incorrect end col offset and line string when input ends without explicit newline

2021-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The question in the issue for tokenizer and virtual newlines is mimicking the C 
tokenizer versus consistency between and within token 5-tuples.

As a tokenizer user, I would lean toward consistency but it is definitely not 
my call.

https://github.com/python/cpython/pull/24260/files has several tokenize.c 
warnings like this:
'=': conversion from '__int64' to 'int', possible loss of data

--
nosy: +gvanrossum, lys.nikolaou, pablogsal, terry.reedy
type:  -> behavior
versions:  -Python 3.6, Python 3.7

___
Python tracker 

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



[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-23 Thread Eryk Sun


Eryk Sun  added the comment:

Thanks, Terry. I should have followed up with a short message asking for a core 
developer to sign off on that suggestion, in which case this is an "easy (C)" 
issue.

--

___
Python tracker 

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



[issue42971] Some errnos for BSD/OSX are missing from errno module

2021-01-23 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
type:  -> enhancement
versions: +Python 3.10 -Python 3.8

___
Python tracker 

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



[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

If I understand correctly, this is open for someone to evaluate Eryk's 
suggestion in msg385291 that a 'missing' return be added to win32_kill.

--
nosy: +terry.reedy
versions:  -Python 3.7

___
Python tracker 

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



[issue42948] bytearray.copy is undocumented

2021-01-23 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch
nosy: +terry.reedy
nosy_count: 3.0 -> 4.0
pull_requests: +23129
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24308

___
Python tracker 

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



[issue43008] IDLE ignores sys.excepthook in normal, subprocess mode

2021-01-23 Thread Andre Roberge


Andre Roberge  added the comment:

Terry: I will put it on my todo list. 

Friendly-traceback can currently work (indirectly) with IDLE; see 
https://aroberge.github.io/friendly-traceback-docs/docs/html/editor.html

I am not sure what benefit this patch will yield when it comes to using 
Friendly-traceback with IDLE compared with what is currently possible.

--

___
Python tracker 

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



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

2021-01-23 Thread Éric Araujo

Éric Araujo  added the comment:

> I feel like if we are to implement this, we should let the developer choose 
> the separator and not limit to just `&` and `;`

That doesn’t feel necessary to me.   I suspect most links use &, some use ;, 
nothing else is valid at the moment and I don’t expect a new separator to 
suddenly appear.  IMO the boolean parameter to also recognize ; was better.

> but that discussion probably belongs in the PR.

PR discussions are generally about how to achieve the goal (fix or new feature) 
and quality of implementation, but tickets is where we agree on what the goal 
is and how to fix it (big picture).

--

___
Python tracker 

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



[issue43008] IDLE ignores sys.excepthook in normal, subprocess mode

2021-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Ken: I will probably work on tests, perhaps as a followup or parallel issue.  I 
will likely do a bit or refactoring to make testing easier.

I just looked at print_exception and discovered that the double traceback can 
likely by handled by properly setting exc.context for the 2nd exception.  But 
getting that right will be aided by having something that already works.

Possible manual test protocol in Shell

>>> import sys
>>> def egood(a,b,c): print('Exception traceback', file=sys.stderr)

>>> sys.excepthook = egood
>>> 1/0
# "Exception traceback"
>>> def ebad(a,b,c): z

>>> sys.excepthook = ebad
>>> 1/0
# Double traceback for ZeroDivisionError and NameError

--

___
Python tracker 

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



[issue43008] IDLE ignores sys.excepthook in normal, subprocess mode

2021-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Andre: while I would like friendlier tracebacks available in IDLE without 3rd 
party installation, I doubt this will happen soon.  In the meanwhile, I see 
that you are working to polish Friendly Traceback with a friendly contest.  I 
presume FT uses sys.excepthook.  If so, this issue is opportune for supporting 
your package.  Feel free to test the minimal patch as is, or when fleshed out, 
and let us know how it works.

--
nosy: +aroberge

___
Python tracker 

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



[issue43011] DeprecationWarnings in test_ctypes

2021-01-23 Thread miss-islington


miss-islington  added the comment:


New changeset 00e24cdca422f792b80016287562b6b3bccab239 by Miss Islington (bot) 
in branch '3.9':
closes bpo-43011: Fix DeprecationWarnings in test_ctypes (GH-24305)
https://github.com/python/cpython/commit/00e24cdca422f792b80016287562b6b3bccab239


--

___
Python tracker 

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



[issue43011] DeprecationWarnings in test_ctypes

2021-01-23 Thread miss-islington


miss-islington  added the comment:


New changeset dce86c230bb91722e84cd3618c1ee9cb55cc220f by Miss Islington (bot) 
in branch '3.8':
closes bpo-43011: Fix DeprecationWarnings in test_ctypes (GH-24305)
https://github.com/python/cpython/commit/dce86c230bb91722e84cd3618c1ee9cb55cc220f


--

___
Python tracker 

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



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

2021-01-23 Thread Ken Jin


Ken Jin  added the comment:

I updated the PR to take in a sequence of separators from the user - eg:

>>> urllib.parse.parse_qsl('a=1=2;c=3', separators=('&', ';'))
[('a', '1'), ('b', '2'), ('c', '3')]
>>> urllib.parse.parse_qsl('a=1=2;c=3', separators=('&',))
[('a', '1'), ('b', '2;c=3')]

I _didn't_ change the default - it will allow both '&' and ';' still. Eric 
showed a link above that still uses semicolon. So I feel that it's strange to 
break backwards compatibility in a patch update. Maybe we can make just '&' the 
default in Python 3.10, while backporting the ability to specify separators to 
older versions so it's up to users?

I'm not sure, any thoughts on this? Opinions would be greatly appreciated.

--

___
Python tracker 

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



[issue43011] DeprecationWarnings in test_ctypes

2021-01-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23128
pull_request: https://github.com/python/cpython/pull/24307

___
Python tracker 

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



[issue43011] DeprecationWarnings in test_ctypes

2021-01-23 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue43011] DeprecationWarnings in test_ctypes

2021-01-23 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset f7fa64f0e87edc61d990ed51b4da722906a10928 by Zackery Spytz in 
branch 'master':
closes bpo-43011: Fix DeprecationWarnings in test_ctypes (GH-24305)
https://github.com/python/cpython/commit/f7fa64f0e87edc61d990ed51b4da722906a10928


--
nosy: +benjamin.peterson
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



[issue43008] IDLE ignores sys.excepthook in normal, subprocess mode

2021-01-23 Thread Ken Hilton


Ken Hilton  added the comment:

Made requested changes, besides the tests. I didn't manage to figure out how to 
go about testing an excepthook in the first place, let alone a good or bad one. 
Hope that's not an issue.

--
Added file: https://bugs.python.org/file49758/bpo-43008.patch.2

___
Python tracker 

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



[issue43006] Changed behaviour of inspect.signature() in Python 3.10

2021-01-23 Thread Ken Jin


Ken Jin  added the comment:

For anyone interested, I went to do some digging on the 3 issues Zac listed:

1. Similar to the first message, this is caused by inspect.getfullarg/signature 
using get_type_hints in Py 3.10. get_type_hints internally converts None to 
NoneType.

2. I don't know what's causing that TypeDict signature to fail.

3. I'm not too sure, but maybe this is intentional according to 
https://www.python.org/dev/peps/pep-0563/#keeping-the-ability-to-use-function-local-state-when-defining-annotations
 ? You can fix it by passing in locals() to get_type_hints (this should work 
all the way back to 3.6)::

import typing

def f():
A = typing.TypeVar("A")
def same_type_args(a: A, b: A):
assert type(a) == type(b)
print(typing.get_type_hints(same_type_args, localns=locals()))

>>> f()
{'a': ~A, 'b': ~A}

The whatsnew should probably be updated to mention this, this is a backwards 
incompatible change after all.

--

___
Python tracker 

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



[issue43008] IDLE ignores sys.excepthook in normal, subprocess mode

2021-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I looked at all 4 hooks.

sys.breakpointhook is invoked by breakpoint() in user code, so is not IDLE's 
concern at present.

sys.unraiseablehook is invoked by the interpreter when user code messes up 
badly, so is not IDLE's condern.  (And it is an expert feature that beginners 
should ignore.)

sys.displayhook is set to rpc.displayhook in run.py or, if started with -n no 
subprocess, pyshell.py.  IDLE executes user code with exec().  Shell entries 
are compiled in 'single' mode.  Exec invokes displayhook for expression 
statements so compiled.  In both normal and -n mode, displayhook exceptions are 
displayed  and processed as user code exceptions, with the last traceback line 
giving the bad line.

sys.excepthook is invoked by the interpreter for uncaught exceptions.
In IDLE's -n mode, sys.excepthook *is* invoked.  If it raises, both tracebacks 
are printed, separated by "\nDuring handling of the above exception, another 
exception occurred:\n".  This issue is about having the same effect in normal 
2-process mode.

Since, in the subprocess, IDLE catches all user exceptions for its custom 
handling, there are no uncaught user exceptions.  I believe your patch calls 
the user hook in the proper place, but an uncaught exception in sys.excepthook 
would be nasty.  Replace the call with something like

try:
sys.e...k(...)
except BaseException as e:
print_exception()
print("\nDuring handling of the above exception, another exception 
occurred:\n", file=sys.stderr)
self.usr_exc_info = sys.exc_info()
print_exception()

If possible, I want a unittest added in test_run.py.  (I am not sure exactly 
how as I don't think we have yet directly faked receipt of compiled user code.)

class Executive(unittest.TextCase):

def test_good_excepthook(self):

def test_bad_excepthook(self):


A blurb is needed (and always is for anything non-trivial).

In Doc/library/idle.rst, I want to insert " and reset display and exception 
handling" before the period ending the current Shell entry.

Restart Shell
  Restart the shell to clean the environment.

--
stage:  -> test needed
title: IDLE ignores sys.excepthook -> IDLE ignores sys.excepthook in normal, 
subprocess mode
versions:  -Python 3.6, Python 3.7

___
Python tracker 

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



[issue43011] DeprecationWarnings in test_ctypes

2021-01-23 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue43011] DeprecationWarnings in test_ctypes

2021-01-23 Thread Zackery Spytz


New submission from Zackery Spytz :

./python -m test test_ctypes
0:00:00 load avg: 1.65 Run tests sequentially
0:00:00 load avg: 1.65 [1/1] test_ctypes
/home/lubuntu2/cpython/Lib/ctypes/test/test_parameters.py:243: 
DeprecationWarning: invalid escape sequence \(
  self.assertRegex(repr(c_char_p.from_param(b'hihi')), "^$")
/home/lubuntu2/cpython/Lib/ctypes/test/test_parameters.py:244: 
DeprecationWarning: invalid escape sequence \(
  self.assertRegex(repr(c_wchar_p.from_param('hihi')), "^$")

== Tests result: SUCCESS ==

1 test OK.

Total duration: 2.4 sec
Tests result: SUCCESS


These warnings were introduced in bpo-42938 / 
916610ef90a0d0761f08747f7b0905541f0977c7.

--
components: Tests, ctypes
messages: 385539
nosy: ZackerySpytz
priority: normal
severity: normal
status: open
title: DeprecationWarnings in test_ctypes
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



[issue43010] @functools.wraps and abc.abstractmethod interoperability

2021-01-23 Thread Erez Zinman


New submission from Erez Zinman :

Consider the following code:

```
from abc import ABC, abstractmethod
from functools import wraps

class A(ABC):
@abstractmethod
def f(self):
pass

@wraps(f)
def wrapper(self):
print('f is called!')
f()

class B(A):
def f(self):
print('f!')

B()
```

The last line of code results in the following error:
>>> TypeError: Can't instantiate abstract class B with abstract methods wrapper

That happens because `wraps` copies the `__dict__` of the original function. 
The problem is that at the point of declaration, the `__dict__` also contained 
`__isabstractmethod__=True` so it was copied as well, and it caused an error on 
the class' instantiation even though it contained no abstract methods. 
Moreover, this behavior is misleading because the the wrapper function is not 
abstract. 

Thanks.

--
components: Extension Modules, Library (Lib)
messages: 385538
nosy: erezinman
priority: normal
severity: normal
status: open
title: @functools.wraps and abc.abstractmethod interoperability
type: behavior
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



[issue42628] binascii doesn't work on some base64

2021-01-23 Thread Kent Watsen


Change by Kent Watsen :


--
nosy:  -kwatsen2

___
Python tracker 

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



[issue42628] binascii doesn't work on some base64

2021-01-23 Thread Kent Watsen


Kent Watsen  added the comment:

No activity in 3 weeks.  Selecting a couple components to give it a bump.

--
components: +C API, Library (Lib)
nosy: +kwatsen

___
Python tracker 

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



[issue43006] Changed behaviour of inspect.signature() in Python 3.10

2021-01-23 Thread Zac Hatfield-Dodds


Zac Hatfield-Dodds  added the comment:

And I promise this is the last one:


import inspect
import typing

def f():
A = typing.TypeVar("A")

def same_type_args(a: A, b: A):
assert type(a) == type(b)

print(inspect.signature(same_type_args))
print(typing.get_type_hints(same_type_args))

f()


$ python3 t.py 
(a: ~A, b: ~A)
{'a': ~A, 'b': ~A}

$ python3.10 t.py 
(a: 'A', b: 'A')
Traceback (most recent call last):
  ...
NameError: name 'A' is not defined


My apologies to everyone involved here; I'm looking forward to postponed 
annotation evaluation, appreciate all your work on this, and regret that I have 
such bizzare bugs to report <3

--

___
Python tracker 

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



[issue43006] Changed behaviour of inspect.signature() in Python 3.10

2021-01-23 Thread Zac Hatfield-Dodds


Zac Hatfield-Dodds  added the comment:

Aaaand it looks like another problem I'm having is also related:


import inspect

class T(typing.TypedDict):
a: int

print(inspect.signature(T))

was `(*args, **kwargs)` and now raises `ValueError: no signature found for 
builtin type `

--

___
Python tracker 

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



[issue43006] Changed behaviour of inspect.signature() in Python 3.10

2021-01-23 Thread Zac Hatfield-Dodds


Zac Hatfield-Dodds  added the comment:

A closely related problem, also via 
https://github.com/HypothesisWorks/hypothesis/issues/2767


import inspect

def f(x) -> None:
pass

annotations = inspect.getfullargspec(f).annotations
assert annotations == {"return": None}, annotations


Under Python 3.10, annotations is now {"return": }

--

___
Python tracker 

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



[issue41798] [C API] Revisit usage of the PyCapsule C API with multi-phase initialization API

2021-01-23 Thread hai shi


hai shi  added the comment:

I have checked all capi instances have been allocated in the heap memory.
So I think this bpo can be closed ;)

Thanks Erlend for your contribution.
Thanks victor, petr for your review

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



[issue43009] Port curses capi pointer array to a struct

2021-01-23 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue43009] Port curses capi pointer array to a struct

2021-01-23 Thread hai shi


New submission from hai shi :

As the title mentioned. A entire py_curses capi struct would be better than 
pointer array.

Related PR: PR 24186

--
assignee: shihai1991
messages: 385532
nosy: shihai1991, vstinner
priority: normal
severity: normal
status: open
title: Port curses capi pointer array to a struct
type: enhancement
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



[issue43002] Exception chaining accepts exception classes

2021-01-23 Thread Mark Dickinson


Change by Mark Dickinson :


--
pull_requests: +23124
pull_request: https://github.com/python/cpython/pull/24303

___
Python tracker 

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



[issue43002] Exception chaining accepts exception classes

2021-01-23 Thread Mark Dickinson


Mark Dickinson  added the comment:

Ram: I think you're conflating two separate things, here:

(1) The ability to use an exception *class* instead of an exception *instance* 
in the "from" clause - that is, the ability to do "raise ValueError from 
TypeError" in place of "raise ValueError from TypeError()"

(2) The lack of a traceback from the local exception-handling context when 
doing raise from.

The two are independent: you'll see the same lack of traceback that you 
described if you do "raise ValueError from TypeError()" instead of "raise 
ValueError from TypeError".

Both behaviours are by design (as Steven already pointed out for (2)). However, 
on point (1), there may be a documentation bug here. The reference manual, 
under 
https://docs.python.org/3/reference/simple_stmts.html#the-raise-statement, says:

> The from clause is used for exception chaining: if given, the second 
> expression must be another exception class or instance, which will then be 
> attached to the raised exception as the __cause__ attribute (which is 
> writable).

However, this description appears not to match the implementation. In the case 
that the second expression is an exception class, it's *not* attached to the 
raised exception as the __cause__ attribute. Instead, the exception class is 
first instantiated, and then the resulting exception *instance* is attached to 
the raised exception as the __cause__ attribute.

The corresponding part of the implementation is here: 
https://github.com/python/cpython/blob/b745a6143ae79efe00aa46affe5ea31a06b0b532/Python/ceval.c#L4758-L4763

Demonstration:

>>> try:
... raise ZeroDivisionError() from RuntimeError
... except Exception as e:
... exc = e
... 
>>> exc.__cause__
RuntimeError()
>>> exc.__cause__ is RuntimeError  # reference manual would suggest this is 
True
False
>>> isinstance(exc.__cause__, RuntimeError)  # actual behaviour
True

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue43002] Exception chaining accepts exception classes

2021-01-23 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

How do you "the wrong message" to implicitly chain exceptions rather 
than explicitly?

The difference between:

 try:
 len(1)
 except TypeError as e:
 raise ValueError(msg) from e

and

 try:
 len(1)
 except TypeError as e:
 raise ValueError(msg)

is that the first traceback says:

"The above exception was the direct cause of the following exception"

and the second says:

"During handling of the above exception, another exception occurred"

Both messages are correct, but if the difference beween the two matters 
to you, feel free to use whichever form you prefer.

--

___
Python tracker 

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



[issue43008] IDLE ignores sys.excepthook

2021-01-23 Thread Ken Hilton


New submission from Ken Hilton :

Similar to https://bugs.python.org/issue12643 - IDLE ignores sys.excepthook and 
always prints exceptions.

--
assignee: terry.reedy
components: IDLE
files: bpo-43008.patch
keywords: patch
messages: 385529
nosy: kenny2minecraft, terry.reedy
priority: normal
pull_requests: 23123
severity: normal
status: open
title: IDLE ignores sys.excepthook
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49757/bpo-43008.patch

___
Python tracker 

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



[issue43007] set_wakeup_fd() only works in main thread

2021-01-23 Thread MeneMeneTekel


New submission from MeneMeneTekel :

This problem is marked as solved in issue38563, BUT the solution refers to some 
signal issues being solved - I'm using Python 3.8.7 on windows 10, where a 
signal solution may not work. I.e. my django (vers. 3.1.5) website crashes 
every second call with the message:

  File 
"C:\Winpython\WPy64-3870\python-3.8.7.amd64\lib\asyncio\proactor_events.py", 
line 632, in __init__
signal.set_wakeup_fd(self._csock.fileno())
ValueError: set_wakeup_fd only works in main thread

--
components: asyncio
messages: 385528
nosy: MeneMeneTekel, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: set_wakeup_fd() only works in main thread
type: crash
versions: Python 3.8

___
Python tracker 

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



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

2021-01-23 Thread Ken Jin


Ken Jin  added the comment:

@Adam:

>I haven't noticed, I'm sorry. I don't mind closing mine, just thought it could 
>be a nice first contribution. 

No worries :), please don't close yours.

> Our PRs are different though - I feel like if we are to implement this, we 
> should let the developer choose the separator and not limit to just `&` and 
> `;` - but that discussion probably belongs in the PR.

You're right, I think that's an elegant solution. In the unlikely event web 
standards change again in another 5 years, the user can change the arguments 
themselves and cpython won't have to change. And like Eric pointed out, some 
people do need ';'.

@senthil
I might make some changes soon, so it may not be ready for review yet. If I go 
ahead with the separator idea, I'll credit Adam as a co-author in the PR, which 
will require them to sign the CLA too.

--

___
Python tracker 

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



[issue43006] Changed behaviour of inspect.signature() in Python 3.10

2021-01-23 Thread Ken Jin


Ken Jin  added the comment:

> This is correct for typing.get_type_hints(), but *not* for 
> inspect.signature(). I therefore suspect that this is an accidental 
> side-effect from support for PEP-563 deferred evaluation of annotations.

Spot on about PEP 563 becoming the default being the culprit!

The what's new for Python 3.10 states that inspect.signature will try to 
resolve types 
https://docs.python.org/3.10/whatsnew/3.10.html#pep-563-postponed-evaluation-of-annotations-becomes-default.

For annotations, inspect.signature internally calls get_type_hints: 
https://github.com/python/cpython/blob/master/Lib/inspect.py#L2194

A simple solution I can think of is to add a flag to get_type_hints to disable 
converting to Optional[int] for inspect.signature.

I nosied some people involved in issue38605 so that they can give their 
opinions on this.

--
nosy: +BTaskaya, gvanrossum, kj

___
Python tracker 

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