[issue36346] Prepare for removing the legacy Unicode C API

2020-06-16 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +20106
pull_request: https://github.com/python/cpython/pull/20927

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Ma Lin


Ma Lin  added the comment:

Why you always want to use "utf-8" encoded identifier as group name in `bytes` 
pattern.

The direction is: a group name written in `bytes` pattern, and will convert to 
`str.
Not this direction: `str` group name -(utf8)-> `bytes` pattern -> `str` group 
name

--

___
Python tracker 

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



[issue19569] Use __attribute__((deprecated)) to warn usage of deprecated functions and macros

2020-06-16 Thread miss-islington


miss-islington  added the comment:


New changeset 2c6d6c12c2d1a8f0c131d70ccf087555c52d4587 by Miss Islington (bot) 
in branch '3.9':
bpo-19569: Add a macro to suppress deprecation warnings (GH-9004)
https://github.com/python/cpython/commit/2c6d6c12c2d1a8f0c131d70ccf087555c52d4587


--

___
Python tracker 

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



[issue40994] Very confusing documenation for abc.Collections

2020-06-16 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

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



[issue32604] [subinterpreters] PEP 554 implementation: add interpreters module

2020-06-16 Thread Eric Snow


Eric Snow  added the comment:

@Pablo, yeah, I'll try to take a look this week.  Are these new failures?

Keep in mind that these tests can sometimes expose existing bugs in our runtime 
(as we fix runtime issues elsewhere) rather than regressions, though that isn't 
necessarily the case here. :)

--

___
Python tracker 

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



[issue40983] urllib.request.url2pathname() unconditionally uses utf-8 encoding and "replace" error handler

2020-06-16 Thread Manuel Jacob

Manuel Jacob  added the comment:

I’ve created issue40996, which suggests that urllib should fsdecode 
percent-encoded parts of file URIs on Unix. Since the two tickets are very 
related and I’d prefer if the issue was solved more generally for the whole 
module, I close this as a duplicate.

--
resolution:  -> duplicate
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



[issue40978] Document that typing.SupportsXXX protocols are runtime checkable

2020-06-16 Thread Guido van Rossum


Guido van Rossum  added the comment:

And here I had hoped that this was a Pull Request. :-)

Note that the docs also still state that these are ABCs -- in fact they are 
Protocols.

I'm not sure why the same info should be repeated for the `@runtime_checkable` 
decorator though.

--

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Quentin Wenger

Quentin Wenger  added the comment:

I just had an "aha moment": What re claims is that, rather than doing as I 
suggested:

> ```
> # consider the following bytestring pattern
> >>> p = b"(?P<\xc3\xba>)"
> 
> # what character does the group name correspond to?
> # maybe we can try to infer it by decoding the bytestring?
> # let's try to do it with the default encoding... that's natural, right?
> >>> p.decode()
> '(?P<ú>)'
> ```

the actual way to know what group name is represented would be to look at the 
(unicode) string with the same "graphical representation":

```
# consider the following bytestring pattern
>>> p = b"(?P<\xc3\xba>)"

# what character does the group name correspond to?
# to discover it, we instead consider the string that "looks the same":
>>> "(?P<\xc3\xba>)"
'(?P<ú>)'

# ok so the group name will be "ú"
```

This way of going from bytes to strings _naively_ (which happens to be called 
latin-1) makes IMHO as much sense as saying that 0x10, 0b10 and 0o10 should be 
the same value, just because they "look the same" in the source code.

This is like throwing away everything we ever learned about Unicode and how a 
code point is fundamentally different from what is stored in memory.

--

___
Python tracker 

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



[issue32604] [subinterpreters] PEP 554 implementation: add interpreters module

2020-06-16 Thread Eric Snow


Eric Snow  added the comment:


New changeset 818f5b597ae93411cc44e404544247d436026a00 by Eric Snow in branch 
'master':
bpo-32604: Clean up test.support.interpreters. (gh-20926)
https://github.com/python/cpython/commit/818f5b597ae93411cc44e404544247d436026a00


--

___
Python tracker 

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



[issue40996] urllib should fsdecode percent-encoded parts of file URIs on Unix

2020-06-16 Thread Manuel Jacob

New submission from Manuel Jacob :

On Unix, file names are bytes. Python mostly prefers to use unicode for file 
names. On the Python <-> system boundary, os.fsencode() / os.fsdecode() are 
used.

In URIs, bytes can be percent-encoded. On Unix, most applications pass the 
percent-decoded bytes in file URIs to the file system unchanged. The remainder 
of this issue description is about Unix, except for the last paragraph.

Pathlib fsencodes the path when making a file URI, roundtripping the bytes e.g. 
passed as an argument:
% python3 -c 'import pathlib, sys; print(pathlib.Path(sys.argv[1]).as_uri())' 
/tmp/a$(echo -e '\xE4')
file:///tmp/a%E4

Example with curl using this URL:
% echo 'Hello, World!' > /tmp/a$(echo -e '\xE4')
% curl file:///tmp/a%E4
Hello, World!

Python 2’s urllib works the same:
% python2 -c 'from urllib import urlopen; 
print(repr(urlopen("file:///tmp/a%E4").read()))'
'Hello, World!\n'

However, Python 3’s urllib fails:
% python3 -c 'from urllib.request import urlopen; 
print(repr(urlopen("file:///tmp/a%E4").read()))' 
Traceback (most recent call last):
  File "/usr/lib/python3.8/urllib/request.py", line 1507, in open_local_file
stats = os.stat(localfile)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/a�'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 525, in open
response = self._open(req, data)
  File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 1485, in file_open
return self.open_local_file(req)
  File "/usr/lib/python3.8/urllib/request.py", line 1524, in open_local_file
raise URLError(exp)
urllib.error.URLError: 

urllib.request.url2pathname() is the function converting the path of the file 
URI to a file name. On Unix, it uses urllib.parse.unquote() with the default 
settings (UTF-8 encoding and the "replace" error handler).

I think that on Unix, the settings from os.fsdecode() should be used, so that 
it roundtrips with pathlib.Path.as_uri() and so that the percent-decoded bytes 
are passed to the file system as-is.

On Windows, I couldn’t do experiments, but using UTF-8 seems like the right 
thing (according to https://en.wikipedia.org/wiki/File_URI_scheme#Windows_2). 
I’m not sure that the "replace" error handler is a good idea. I prefer "errors 
should never pass silently" from the Zen of Python, but I don’t a have a strong 
opinion on this.

--
components: Library (Lib), Unicode
messages: 371702
nosy: ezio.melotti, mjacob, vstinner
priority: normal
severity: normal
status: open
title: urllib should fsdecode percent-encoded parts of file URIs on Unix
type: behavior

___
Python tracker 

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



[issue32604] [subinterpreters] PEP 554 implementation: add interpreters module

2020-06-16 Thread Eric Snow


Change by Eric Snow :


--
pull_requests: +20105
pull_request: https://github.com/python/cpython/pull/20926

___
Python tracker 

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



[issue40995] reprlib.Repr.__init__ should accept arguments

2020-06-16 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


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

___
Python tracker 

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



[issue40995] reprlib.Repr.__init__ should accept arguments

2020-06-16 Thread Rémi Lapeyre

New submission from Rémi Lapeyre :

reprlib.Repr does not accept arguments for the moment so setting its attributes 
must be done in multiple steps:

import reprlib
r = reprlib.Repr()
r.maxstring = 10
r.maxset = 4
r.repr(...)


It would be more user-friendly to be able to do:

import reprlib
r = reprlib.Repr(maxstring=10, maxset=4)
r.repr(...)

--
components: Library (Lib)
messages: 371701
nosy: remi.lapeyre
priority: normal
severity: normal
status: open
title: reprlib.Repr.__init__ should accept arguments
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue22433] Argparse considers unknown optional arguments with spaces as a known positional argument

2020-06-16 Thread daniel hahler


Change by daniel hahler :


--
nosy: +blueyed
nosy_count: 3.0 -> 4.0
pull_requests: +20102
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20924

___
Python tracker 

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



[issue40990] Make http.server support SSL

2020-06-16 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


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

___
Python tracker 

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



[issue39949] truncating match in regular expression match objects repr

2020-06-16 Thread Quentin Wenger


Quentin Wenger  added the comment:

File objects are an example of a square-bracket repr with string parameters in 
the repr, but no truncation is performed (see 
https://github.com/python/cpython/blob/master/Modules/_io/textio.c#L2912).

Various truncations with the same (lack of?) clarity are done in the stdlib, 
see eg. 
https://github.com/python/cpython/blob/04fc4f2a46b2fd083639deb872c3a3037fdb47d6/Objects/longobject.c#L2475.

--

___
Python tracker 

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



[issue39949] truncating match in regular expression match objects repr

2020-06-16 Thread Quentin Wenger


Quentin Wenger  added the comment:

Oh ok, I was mislead by the example in your first message, where you did have 
both the quote and ellipsis.

I don't have a strong opinion.
- having the quote is a bit more "clean"
- but not having it makes clear than the pattern is truncated (per se, three 
dots is a valid pattern)

The best would be to find a precedent in the stdlib, but I currently cannot 
think of any either.

--

___
Python tracker 

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



[issue39949] truncating match in regular expression match objects repr

2020-06-16 Thread Seth Troisi


Seth Troisi  added the comment:

@matpi

The current behavior is for the right quote to not appear I kept this behavior 
but happy to consider changing that.

See the linked patch for examples

--

___
Python tracker 

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



[issue23427] Add sys.orig_argv: original command line arguments passed to the Python executable

2020-06-16 Thread STINNER Victor


Change by STINNER Victor :


--
versions: +Python 3.10 -Python 3.5

___
Python tracker 

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



[issue39949] truncating match in regular expression match objects repr

2020-06-16 Thread Seth Troisi


Change by Seth Troisi :


--
keywords: +patch
pull_requests: +20100
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/20922

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Quentin Wenger


Quentin Wenger  added the comment:

You questioned my knowledge of encodings. Let's quote from one of the most 
famous introductory articles on the subject 
(https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/):

> It does not make sense to have a string without knowing what encoding it uses

So I have that bytestring that comes from somewhere, maybe it was originally 
utf-8 or cp1250 or ... encoded, but I won't tell or don't know, the only thing 
I swear is that it originally was a valid Python identifier.
Now I pass it as a group name in re.match (it was a valid Python identifier, so 
that has to be alright per the docs) and I get back a (unicode) string.
re.match, how dare you giving me back a string when _you have no clue what my 
bytestring originally represented, resp. what it originally was encoded with_?
Maybe re.match will even crash, because it wrongly and assumes the bytestring 
to have been latin-1 encoded!

So: latin-1 is an arbitrary choice that is no better than any other, and the 
fact that it "naturally" converts bytes to unicode code points is an 
implementation detail.
If you want to keep it so, it ought (cf. the quote above) to be made clear in 
the docs that group names come out as latin-1-encoded strings, with all the 
restrictions that follow from that choice.
But the more logical way would be to renounce this arbitrary encoding 
altogether.

--

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Quentin Wenger

Quentin Wenger  added the comment:

The problem can also be played in reverse, maybe it is more telling:

```
# consider the following bytestring pattern
>>> p = b"(?P<\xc3\xba>)"

# what character does the group name correspond to?
# maybe we can try to infer it by decoding the bytestring?
# let's try to do it with the default encoding... that natural, right?
>>> p.decode()
'(?P<ú>)'

# so we can reasonably expect the group name to be ú, right?
>>> list(re.compile(p).groupindex.keys()).pop()
'ú'

# Fail.
```

--

___
Python tracker 

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



[issue40979] typing module docs: keep text, add subsections

2020-06-16 Thread ramalho


ramalho  added the comment:

Sorry, there was an editing mistake above.

Where I wrote:


- AnyStr: should be listed right after TypeVar, NoReturn, NewType

I meant to write:

- AnyStr: should be listed right after TypeVar
- NoReturn, NewType: both belong with "Special Constructs" as well
- Text, TYPE_CHECKING: I am not sure about those ...

--

___
Python tracker 

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



[issue40979] typing module docs: keep text, add subsections

2020-06-16 Thread ramalho


ramalho  added the comment:

Thanks, I am happy to submit a PR. Before I do, I'd like to discuss the 
subsection titles, starting from the arrangement in typing.__all__:


# Special typing constructs (source comment is: "Super-special typing 
primitives")
Any Callable ClassVar Final ForwardRef Generic Literal Optional Protocol Tuple 
Type TypeVar Union 

In this section I propose we add:

- NamedTuple and TypedDict: source comments say "Not really a type" (for both), 
and I believe it's confusing to list them along the other collections. Tuple is 
already in the "Special constructs" category, so NamedTuple should follow in 
there. TypedDict is very different from the other collections, it's purely a 
type hinting construct with no runtime counterpart so it's pretty special IMHO.

- AnyStr: should be listed right after TypeVar, NoReturn, NewType

- Text, TYPE_CHECKING: I am not sure about those, but if they are removed from 
the "One-off things" all that remains are functions and decorators, which looks 
good.


# ABCs (from collections.abc) [Keep this title]
AbstractSet ByteString Container ContextManager Hashable ItemsView Iterable 
Iterator KeysView Mapping MappingView MutableMapping MutableSequence MutableSet 
Sequence Sized ValuesView Awaitable AsyncIterator AsyncIterable Coroutine 
Collection AsyncGenerator AsyncContextManager

# Concrete collection types [keep this title]
ChainMap Counter Deque Dict DefaultDict List OrderedDict Set FrozenSet 

- Generator should go with "ABCs"
- NamedTuple TypedDict should go with "Special typing constructs"

 
# Protocols (source comment is "Structural checks, a.k.a. protocols.")
Reversible SupportsAbs SupportsBytes SupportsComplex SupportsFloat 
SupportsIndex SupportsInt SupportsRound


# Functions and decorators (source comment is "One-off things.")
cast final get_args get_origin get_type_hints no_type_check 
no_type_check_decorator  overload runtime_checkable 

- AnyStr NewType NoReturn: these should go with "Special typing constructs"

- Text TYPE_CHECKING: either go with "Special typing constructs" or a constants 
section, which could include AnyStr as well

There are also the IO and re types which could have their own subsections.

Looking forward for feeback on this. Thanks!

--

___
Python tracker 

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



[issue13554] Tkinter doesn't use higher resolution app icon

2020-06-16 Thread E. Paine


E. Paine  added the comment:

This is a tk issue, as it can be reproduced using 'wish' (tcl 8.6.10):

wm title . "APP title"
wm iconname . APP
image create photo .iconL -file icon256.png
image create photo .iconS -file icon48.png
wm iconphoto . -default .iconL .iconS

Thank you th9 for reporting this, but it should be closed as "third party".

--
nosy: +epaine

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Quentin Wenger

Quentin Wenger  added the comment:

And there's no need for a cryptic encoding like cp1250 for this problem to 
arise. Here is a simple example with Python's default encoding utf-8:

```
>>> a = "ú"
>>> b = list(re.match(b"(?P<" + a.encode() + b">)", b"").groupdict())[0]
>>> a.isidentifier()
True
>>> b.isidentifier()
True
>>> b
'ú'
>>> a.encode() == b.encode("latin1")
True
```

For reference, here is the very source of the issue: 
https://github.com/python/cpython/blob/master/Lib/sre_parse.py#L228

--

___
Python tracker 

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



[issue40594] urljoin since 3.5 incorrectly filters out double slashes

2020-06-16 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

> How did you test them?

https://about.google//products/
https://www.google.com///search?q=something

Were redirecting, and collapsing multiple slashes to single.

Now, when I try this on:

> https://en.wikipedia.org/w//index.php?search=foobar+something

was not.

Sorry. It is false to say that it was a default client behavior of chrome.

--

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +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



[issue40994] Very confusing documenation for abc.Collections

2020-06-16 Thread Sydney Pemberton


New submission from Sydney Pemberton :

I was writing a Jupyter notebook at the time, which I think perfectly 
illustrated the blind alley this documentation bug led me down before beating 
me up and stealing my lunch money.

I have come to this point in the documentation at least half a dozen times 
while learning Python and always left confused and with the sense that Python 
is more complicated than I had thought. 

Notebook attached. 

This documentation style violates two principles:
 - The implied structure of headings and content below it.
 - Many natural languages do not contain context-sensitive grammar and so using 
the "respectively" idiom can be very confusing for people who speak English as 
a second language.

--
assignee: docs@python
components: Documentation
files: Confusing docs.ipynb
messages: 371690
nosy: Sydney Pemberton, docs@python
priority: normal
severity: normal
status: open
title: Very confusing documenation for abc.Collections
versions: Python 3.8
Added file: https://bugs.python.org/file49238/Confusing docs.ipynb

___
Python tracker 

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



[issue1222585] C++ compilation support for distutils

2020-06-16 Thread Christian Heimes


Christian Heimes  added the comment:

Please report the issue with setuptools. distutils is no longer under 
development. We recommend that all users use setuptools.

--

___
Python tracker 

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



[issue1222585] C++ compilation support for distutils

2020-06-16 Thread Ryan Schmidt


Ryan Schmidt  added the comment:

What needs to happen to get this 15 year old bug fixed? It prevents C++ Python 
modules from being compiled in situations where the user needs to supply 
CXXFLAGS.

--
nosy: +ryandesign

___
Python tracker 

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



[issue22167] iglob() has misleading documentation (does indeed store names internally)

2020-06-16 Thread Guido van Rossum


Guido van Rossum  added the comment:

Sounds good.

FWIW, and totally off-topic, I find it annoying that pathlib's .glob() method 
supports ** in patterns, but its cousing .match() does not:

>>> p = pathlib.Path("Lib/test/support/os_helper.py")
>>> p.match("Lib/**/*.py")
False
>>>

--

___
Python tracker 

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



[issue40958] ASAN/UBSAN: heap-buffer-overflow in pegen.c

2020-06-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 7795ae8f05a5b1134a576a372f64699176cac5fb by Miss Islington (bot) 
in branch '3.9':
bpo-40958: Avoid buffer overflow in the parser when indexing the current line 
(GH-20875) (GH-20919)
https://github.com/python/cpython/commit/7795ae8f05a5b1134a576a372f64699176cac5fb


--

___
Python tracker 

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



[issue40594] urljoin since 3.5 incorrectly filters out double slashes

2020-06-16 Thread Open Close


Open Close  added the comment:

To Senthil Kumaran:

https://bugs.python.org/issue40594#msg371092
> As far as I know, the browsers remove them, combine them as a single URL. 
> (Tested on Chrome with some URLs to confirm on June 2020)

How did you test them?

--
nosy: +op368

___
Python tracker 

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



[issue40893] tkinter: integrate TkDND support

2020-06-16 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
components: +Tkinter
title: None -> tkinter: integrate TkDND support
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



[issue40987] Add tests to test_interpreters to import C extension modules converted to PEP 489 multiphase initialization

2020-06-16 Thread Dong-hee Na


Dong-hee Na  added the comment:

> According to Dong-hee, importing dbm in a subinterpreter leaks references:

GH-20920 fixed the leak :)

--

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-06-16 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset c4862e333ab405dd5789b4061222db1982147de4 by Dong-hee Na in branch 
'master':
bpo-1635741: Port _gdbm module to multiphase initialization (GH-20920)
https://github.com/python/cpython/commit/c4862e333ab405dd5789b4061222db1982147de4


--

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread hai shi


hai shi  added the comment:

> Coverage jobs are still run with my changes.
> https://codecov.io/gh/python/cpython is still updated.

Copy that, thanks.

--

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Quentin Wenger

Quentin Wenger  added the comment:

> > this limitation to the latin-1 subset is not compatible with the 
> > documentation, which says that valid Python identifiers are valid group 
> > names.
> 
> Not all latin-1 characters are valid identifier, for example:
> 
> >>> '\x94'.encode('latin1')
> b'\x94'
> >>> '\x94'.isidentifier()
> False

True but that's not the point. Δ is a valid Python identifier but not a valid 
group name in bytes regexes, because it is not in the latin-1 plane. The 
documentation does not mention this.


> There is a workaround, you can convert `bytes` to `str` with "latin-1" 
> decoder before processing, IIRC there will be no extra overhead 
> (memory/speed) during processing, then the name and content are the same 
> type. :)

I am not searching a workaround for my current code.

And the simplest workaround is to latin-1-convert back to bytes, because re 
should not latin-1-convert to string in the first place.

Are you saying that the proper way to use bytes regexes is to use string 
regexes instead?


> Please look at these:
> 
> >>> orig_name = "Ř"
> >>> orig_ch = orig_name.encode("cp1250") # Because why not?
> >>> orig_ch
> b'\xd8'
> >>> name = list(re.match(b"(?P<" + orig_ch + b">)", 
> b"").groupdict().keys())[0]
> >>> name
> 'Ø'  # '\xd8'
> >>> name == orig_name
> False
> >>> name.encode("latin-1")
> b'\xd8'
> >>> name.encode("latin-1") == orig_ch
> True
> 
> "Ř" (\u0158) --cp1250--> b'\xd8'
> "Ø" (\u00d8) --latin-1--> b'\xd8'

That's no surprize, I carefully crafted this example. :-)

Rather, that is exactly my point: several different strings (which can all be 
valid Python identifiers) can have the same single-byte representation, simply 
by the mean of different encodings (duh).

So why convert group names to strings when outputting them from matches, when 
you don't know where the bytes come from, or even whether they ever were 
strings? That should be left to the programmer.

--

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread STINNER Victor


STINNER Victor  added the comment:

> coverage jobs can tell us how many features need add unit tests.

Coverage jobs are still run with my changes. 
https://codecov.io/gh/python/cpython is still updated.

My change only stops running coverage jobs on pull requests.

--

___
Python tracker 

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



[issue40987] Add tests to test_interpreters to import C extension modules converted to PEP 489 multiphase initialization

2020-06-16 Thread STINNER Victor


STINNER Victor  added the comment:

According to Dong-hee, importing dbm in a subinterpreter leaks references:
https://github.com/python/cpython/pull/20920#issuecomment-644856401

--

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-06-16 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +20099
pull_request: https://github.com/python/cpython/pull/20920

___
Python tracker 

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



[issue40893] None

2020-06-16 Thread Nam Tran


Change by Nam Tran :


--
components: +Library (Lib) -Tkinter
title: tkinter integrate TkDND support -> None
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



[issue37857] Setting logger.level directly has no effect due to caching in 3.7+

2020-06-16 Thread STINNER Victor


STINNER Victor  added the comment:

Vinay:
> That code in the wild that sets the level attribute directly is wrong and 
> should be changed, right? The documentation has always been clear that 
> setLevel() should be used. If we now take steps to support setting the level 
> via attribute, isn't that encouraging bypassing the documented APIs? I'm not 
> sure such misuse is widespread.

I understood that Zane Bitter opened this issue *because* people misuses the 
logging API.


Vinay:
> (...) Sure, mistakes will happen, and that's the price paid when one doesn't 
> follow documentation. It feels wrong to do this as a band-aid to help out 
> people who didn't do the right thing.

setLevel() enforces consistency: it calls _checkLevel() to convert string to 
integer. Also, Logger.setLevel() also invalidates caches.

Having a way to update the level without invalidating caches sounds like a bug 
to me.

--

Zane proposed to deprecate setting the level attribute in PR 15286. I dislike 
this idea. It's kind of weird to be able to *read* a public attribute but not 
to *set* it. Either the attribute should be removed by adding a getLevel() 
method (and deprecate the attribute and then remove it), or it should be 
possible to get and set it.

I'm in favor of not deprecating "logger.level = level". Just wrap it into a 
property silently.

--

I rewrote the microbenchmark using pyperf:
---
import pyperf

class Logger(object):
def __init__(self):
self._levelprop = self.level = 0

@property
def levelprop(self):
return self.level


logger = Logger()
ns = {'logger': logger}
runner = pyperf.Runner()
runner.timeit('read attribute', 'logger.level', globals=ns)
runner.timeit('read property', 'logger.levelprop', globals=ns)
---

Result:

* read attribute: Mean +- std dev: 38.9 ns +- 0.8 ns
* read property: Mean +- std dev: 104 ns +- 3 ns

Reading a property is 2.7x slower than reading an attribute. Well, that's not 
surprising to have an overhead. But the absolute numbers remain reasonable. 
We're talking about 100 ns, not 100 ms.

IMHO the overhead is reasonable in 3rd party code. Inside the logging module, 
only the private _level attribute should be used and so there is no overhead.

--
nosy: +vstinner

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread hai shi


hai shi  added the comment:

> Attached PR skips these jobs on pull requests.
I am not familiar with travis ci. coverage jobs can tell us how many features 
need add unit tests. Can we use other CI services to do this job? MAYBE in 
checks gate or something other services like buildbot.python.org?

--

___
Python tracker 

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



[issue40958] ASAN/UBSAN: heap-buffer-overflow in pegen.c

2020-06-16 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Ma Lin

Ma Lin  added the comment:

Please look at these:

>>> orig_name = "Ř"
>>> orig_ch = orig_name.encode("cp1250") # Because why not?
>>> orig_ch
b'\xd8'
>>> name = list(re.match(b"(?P<" + orig_ch + b">)", 
b"").groupdict().keys())[0]
>>> name
'Ø'  # '\xd8'
>>> name == orig_name
False
>>> name.encode("latin-1")
b'\xd8'
>>> name.encode("latin-1") == orig_ch
True

"Ř" (\u0158) --cp1250--> b'\xd8'
"Ø" (\u00d8) --latin-1--> b'\xd8'

--

___
Python tracker 

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



[issue40958] ASAN/UBSAN: heap-buffer-overflow in pegen.c

2020-06-16 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +20098
pull_request: https://github.com/python/cpython/pull/20919

___
Python tracker 

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



[issue40958] ASAN/UBSAN: heap-buffer-overflow in pegen.c

2020-06-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 51c5896b6205911d29ac07f167ec7f3cf1cb600d by Pablo Galindo in 
branch 'master':
bpo-40958: Avoid buffer overflow in the parser when indexing the current line 
(GH-20875)
https://github.com/python/cpython/commit/51c5896b6205911d29ac07f167ec7f3cf1cb600d


--

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread miss-islington


miss-islington  added the comment:


New changeset 071bed842eeff9673bc5c4f64e3916a151132d2a by Miss Islington (bot) 
in branch '3.8':
bpo-40993: Don't run Travis CI coverage on PRs (GH-20916)
https://github.com/python/cpython/commit/071bed842eeff9673bc5c4f64e3916a151132d2a


--

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread miss-islington


miss-islington  added the comment:


New changeset 3cf809475a93228a3cb310b4d10d38f3b9d44c1f by Miss Islington (bot) 
in branch '3.9':
bpo-40993: Don't run Travis CI coverage on PRs (GH-20916)
https://github.com/python/cpython/commit/3cf809475a93228a3cb310b4d10d38f3b9d44c1f


--

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Ma Lin


Ma Lin  added the comment:

> this limitation to the latin-1 subset is not compatible with the 
> documentation, which says that valid Python identifiers are valid group names.

Not all latin-1 characters are valid identifier, for example:

>>> '\x94'.encode('latin1')
b'\x94'
>>> '\x94'.isidentifier()
False

There is a workaround, you can convert `bytes` to `str` with "latin-1" decoder 
before processing, IIRC there will be no extra overhead (memory/speed) during 
processing, then the name and content are the same type. :)

--

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue40989] [C API] Remove _Py_NewReference() and _Py_ForgetReference() from the public C API

2020-06-16 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset fcc60e40bbfe8a229b8b83f1d1ee77fd4bf870d1 by Victor Stinner in 
branch 'master':
bpo-40989: Make _PyTraceMalloc_NewReference() internal (GH-20915)
https://github.com/python/cpython/commit/fcc60e40bbfe8a229b8b83f1d1ee77fd4bf870d1


--

___
Python tracker 

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



[issue37673] Tkinter won't create 5000 check boxes, stops at 1309.

2020-06-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Lou, when you respond by email, please snip the already posted email you are 
responding to.  The redundant noise makes *your* message harder to read.  
(Leaving an especially relevant line or two is OK.)

E.Paine.  Thank you for the confirmation.  Learning tcl/tk well enough to write 
test cases like this is something I have avoided, and Serhiy mostly works on 
other modules.  I hope you continue.

--

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20097
pull_request: https://github.com/python/cpython/pull/20918

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 1.0 -> 2.0
pull_requests: +20096
pull_request: https://github.com/python/cpython/pull/20917

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset fc710ee266e9461fdba9933ec6004318db588820 by Victor Stinner in 
branch 'master':
bpo-40993: Don't run Travis CI coverage on PRs (GH-20916)
https://github.com/python/cpython/commit/fc710ee266e9461fdba9933ec6004318db588820


--
message_count: 5.0 -> 6.0
nosy: +miss-islington
nosy_count: 1.0 -> 2.0
pull_requests: +20096
pull_request: https://github.com/python/cpython/pull/20917

___
Python tracker 

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



[issue37673] Tkinter won't create 5000 check boxes, stops at 1309.

2020-06-16 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue40991] Can't open more than on .py file with IDLE

2020-06-16 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
assignee: terry.reedy -> 

___
Python tracker 

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



[issue40991] Can't open more than on .py file with IDLE

2020-06-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Almost certainly Catalina - tcl/tk issue.  Fix difficult and unknown.  Won't 
make 3.7.  In the meanwhile, use IDLE's file=> open menu.  See original issue 
38946 for more.

--
components: +macOS -IDLE
nosy: +ned.deily, ronaldoussoren
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> IDLE on macOS 10.15 Catalina does not open double-clicked files 
if app already launched

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread STINNER Victor


STINNER Victor  added the comment:

Documentation about skipping jobs on pull requests:
https://docs.travis-ci.com/user/pull-requests/#how-pull-requests-are-built

I don't think that the following method works for the issue:

"To only build on push events not on pull requests, disable Build on Pull 
Requests in your repository settings."

That would disable all jobs, not only coverage jobs.

--

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-40237: "Test code coverage (C) job of Travis CI fails on 
test_distutils which creates _configtest.gcno file".

--

___
Python tracker 

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



[issue40971] Documentation still mentions 'u' string formatting option

2020-06-16 Thread Shubham Upreti


Shubham Upreti  added the comment:

Should i take this issue?

--
nosy: +shubh07

___
Python tracker 

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



[issue40237] Test code coverage (C) job of Travis CI fails on test_distutils which creates _configtest.gcno file

2020-06-16 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-40993: "Don't run Python and C coverage jobs of Travis CI on pull 
requests".

--

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread STINNER Victor


STINNER Victor  added the comment:

See also "Travis CI doesn't report its status or doesn't run on Python pull 
requests":
https://github.com/python/core-workflow/issues/371

--

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread STINNER Victor

STINNER Victor  added the comment:

Concrete issue: on my PR 20915, Travis CI mandatory jobs completed successfully 
but I wasn't able to merge the PR since GitHub says "travis-ci/pr Pending — The 
Travis CI build is in progress".

I cancelled the last running coverage job... but I was still unable to merge 
the PR, since Travis CI didn't report the status to GitHub.

I had to reschedule all Travis CI jobs...

--

___
Python tracker 

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



[issue40993] Don't run Python and C coverage jobs of Travis CI on pull requests

2020-06-16 Thread STINNER Victor


New submission from STINNER Victor :

Currently, Travis CI runs C coverage and Python coverage jobs on all pull 
requests. This is a waste of resources: we should only run these jobs on 
branches like master.

Attached PR skips these jobs on pull requests.

Not only it's a waste of resources, but it seems like it's not longer possible 
to merge a PR as soon as Travis CI required jobs pass: a PR can only be merged 
when *all* Travis CI jobs complete. Problem: while a full test suite run takes 
around 20 min, coverage jobs take longer than 40 minutes.

By the way, the C coverage job fails with timeout, but that's a different issue.

--
components: Build
messages: 371661
nosy: vstinner
priority: normal
severity: normal
status: open
title: Don't run Python and C coverage jobs of Travis CI on pull requests
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



[issue37369] Issue with pip in venv on Powershell in Windows

2020-06-16 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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Quentin Wenger

Quentin Wenger  added the comment:

I prove my point that the decoding to string is arbitrary:

```
>>> import re
>>> orig_name = "Ř"
>>> orig_ch = orig_name.encode("cp1250") # Because why not?
>>> name = list(re.match(b"(?P<" + orig_ch + b">)", b"").groupdict().keys())[0]
>>> name == orig_name
False
>>> name
'Ø'
>>> name.encode("latin-1") == orig_ch
True
```

For any dynamically-constructed bytes regex pattern, a string group name as 
output is unusable. Only after latin-1-reencoding can it be safely compared. 
This latin-1 choice is arbitrary.

--

___
Python tracker 

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



[issue40992] Wrong warning in asyncio debug mode

2020-06-16 Thread Alex Alex


New submission from Alex Alex :

I run code in example and get message like:
Executing () created at /usr/lib/python3.7/asyncio/futures.py:288> 
took 2.000 seconds

It say that coroutine run for 2 second but it was run for 5 second. Also if I 
comment part in qwe function after await I won't get any warning, but should.

--
components: asyncio
files: asyncio-wrong-warn.py
messages: 371659
nosy: Alex Alex, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Wrong warning in asyncio debug mode
versions: Python 3.7
Added file: https://bugs.python.org/file49237/asyncio-wrong-warn.py

___
Python tracker 

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



[issue40989] [C API] Remove _Py_NewReference() and _Py_ForgetReference() from the public C API

2020-06-16 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +20094
pull_request: https://github.com/python/cpython/pull/20915

___
Python tracker 

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



[issue40991] Can't open more than on .py file with IDLE

2020-06-16 Thread Brendan Steffens


New submission from Brendan Steffens :

I am using Python 3.7.2, macOS Catalina 10.15.5.

When I double click a .py script from the Finder, it opens it, along with IDLE 
shell. When I click a second .py script so I can view both at once, it won't 
open the second one.

--
assignee: terry.reedy
components: IDLE
messages: 371658
nosy: BrendanSteffens, terry.reedy
priority: normal
severity: normal
status: open
title: Can't open more than on .py file with IDLE
type: behavior
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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Quentin Wenger


Quentin Wenger  added the comment:

> It seems you don't know some knowledge of encoding yet.

I don't have to be ashamed of my knowledge of encoding. Yet you are right that 
I was missing a subtlety, which is that latin-1 is a strict subset of Unicode 
rather than a completely arbitrary encoding. Thank you for that.

So what you are saying is that group names in bytes regexes can only be 
specified directly (without -explicit- encoding), so de facto they are limited 
to the latin-1 subset.

Very well.

But then, once again:

1) why convert them to string when spitting them out? bytes they were when 
going in, bytes they should remain... **By converting them you are choosing an 
arbitrary encoding, even if it is the "natural" one.**
2) this limitation to the latin-1 subset is not compatible with the 
documentation, which says that valid Python identifiers are valid group names. 
If this was really the case, then I would expect to be able to use any string 
for which .isidentifier() is true as a group name, programmatically.

--

___
Python tracker 

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



[issue40989] [C API] Remove _Py_NewReference() and _Py_ForgetReference() from the public C API

2020-06-16 Thread STINNER Victor


STINNER Victor  added the comment:

> In the CPython code base, _Py_NewReference() is used:
> * to implement the free list optimization

I found a similar code pattern outside CPython code base.

Like Nuitka generic macros for free lists:
https://github.com/Nuitka/Nuitka/blob/8e2357ee8e9a93d835e98d5a88ca0181cc34dabc/nuitka/build/include/nuitka/freelists.h#L22

Another example in the old unmaintained gmpy project (last release in 2013):
https://github.com/LogicalKnight/gmpy/blob/5d758abc9fcb44b08dd000145afe48160bd802f1/src/gmpy2_cache.c#L93-L111

These functions can opt-in for the internal C API to continue to get access to 
_Py_NewReference().

Or maybe free lists should be implemented differently? (is it possible?)


> * in _PyBytes_Resize() and unicode_resize() (resize_compact() to be precise)

Third-party code can use the public PyUnicode_Resize() function and the private 
_PyBytes_Resize() function. Later, if needed, we can consider to expose 
_PyBytes_Resize() in the limited C API.


> * by PyObject_CallFinalizerFromDealloc() to resurrect an object

I found a few projects which basically reimplement the PEP 442 logic in their 
tp_dealloc function. Example with pyuv resurrect_object() function:
https://github.com/saghul/pyuv/blob/9d226dd61162a998745681eb87ef34e1a7d8586a/src/handle.c#L9

For these, using PEP 442 tp_finalizer here would avoid relying on private 
functions like _Py_NewReference(), make the code simpler and more reliable.

--

___
Python tracker 

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



[issue37369] Issue with pip in venv on Powershell in Windows

2020-06-16 Thread miikama


miikama  added the comment:

Hi,

First time reporting so feel free to direct me to a better place if this is not 
the correct place :)

I am still facing the issue that started this thread with Python 3.8 and 3.9. 

Steps to reproduces
1. Clean install of Python 3.9.0b3 (quick install via .exe 
https://www.python.org/downloads/windows/)

2. create a python virtual environment in powershell

   python -m venv env
or with absolute path: python -m venv C:\Users\\\env


3. activate virtual environment 

  .\env\Scripts\Activate.ps1

4. use pip

(env) PS C:\Users\\ python --version
Python 3.9.0b3
(env) PS C:\Users\\ pip --version
Fatal error in launcher: Unable to create process using 
'"c:\users\\\env\scripts\python.exe"  
"C:\Users\\\env\Scripts\pip.exe" --version'

However, python and pip are installed in the env\Scripts\*

(env) PS C:\Users\\ Get-Command python
python.exe 3.9.113 C:\Users\\\env\Scripts\python.exe

(env) PS C:\Users\\ Get-Command pip
pip.exe 0.0.0.0 C:\Users\\\env\Scripts\pip.exe

But the pip module is not actually found by the python interpreter inside the 
virtual environment.

(env) PS C:\Users\\ python -m pip --version
C:\Users\\\env\Scripts\python.exe: No module named pip





Notes:

1. the global pip installation works well and can be used to install packages

PS C:\Users\\ pip --version
pip 19.2.3 from 
c:\users\\appdata\local\programs\python\python39\lib\site-packages\pip 
(python 3.9)

2. Windows version: Microsoft Windows [Version 10.0.18363.836]

3. Powershell Version: 5.1.18362.752

4. Paths in a python interpreter started in the active env

(env) PS C:\Users\\ python
>>> import sys,os

>>> sys.exec_prefix
'C:\\Users\\env'

>>> sys.base_prefix
'C:\\UsersAppData\\Local\\Programs\\Python\\Python39'

>>> sys.path
['', 
'C:\\UsersAppData\\Local\\Programs\\Python\\Python39\\python39.zip', 
'C:\\UsersAppData\\Local\\Programs\\Python\\Python39\\DLLs', 
'C:\\UsersAppData\\Local\\Programs\\Python\\Python39\\lib', 
'C:\\UsersAppData\\Local\\Programs\\Python\\Python39', 
'C:\\Users\\env']

>>> import pip
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'pip'

quit()



I did not find more recent bugs related to this and wanted to bring the issue 
back to your attention. At least to me, based on the discussion here it seemed 
that the issue should have been fixed. Please let me know if you need any 
further input.

--
nosy: +miikama
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



[issue40989] [C API] Remove _Py_NewReference() and _Py_ForgetReference() from the public C API

2020-06-16 Thread STINNER Victor


STINNER Victor  added the comment:

See "Removal of _Py_ForgetReference from public header in 3.9 issue" discussion 
on capi-sig:
https://mail.python.org/archives/list/capi-...@python.org/thread/4EOCN7P4HI56GQ74FY3TMIKDBIPGKL2G/

--

___
Python tracker 

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



[issue40984] re.compile's repr truncates patterns at 200 characters

2020-06-16 Thread Quentin Wenger


Quentin Wenger  added the comment:

I welcome any counter-example to the eval()'able property in the stdlib.

I do believe in this rule as hard and fast, because it works for small 
patterns, only bitting you when you grow, probably programmatically (so exactly 
when you actually could need the repr).

Furthermore, 200 seems very low anyway by today standards. I mean, if you want 
a repr in the first place, then chances are that you want it full if 
(reasonably) possible.

If a string repr's itself fully no matter what, why should re.compile 
arbitrarily decide to truncate its argument?

--

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Ma Lin


Ma Lin  added the comment:

It seems you don't know some knowledge of encoding yet.

Naturally, `bytes` cannot contain character which Unicode code point is greater 
than \u00ff. So you can only use "latin1" encoding, which map from character to 
byte (or reverse) directly.

"utf-8", "utf-16" and "utf-32" are all encoding codecs, "utf-8" should not have 
a special status in this scene.

--
nosy:  -ezio.melotti, mrabarnett

___
Python tracker 

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



[issue40680] thread_cputime isn't supported by AIX5

2020-06-16 Thread STINNER Victor


STINNER Victor  added the comment:

> There is still a lot of AIX 6.1 out there, and iirc, there may be "extended" 
> support available.

This issue is about AIX5 support. I'm fine with providing best effort support 
for AIX 6.1. If supporting AIX 6 becomes too expensive, we can consider to drop 
support for this version.

Anyway, I close this issue: I don't think that it's worth it to attempt to 
support AIX 5 in Python 3.10: AIX 5 is no longer supported by its vendor (IBM). 
Use Python 3.9 which seems to better support AIX 5 (don't need 
thread_cputime()).

--
resolution:  -> rejected
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



[issue39949] truncating match in regular expression match objects repr

2020-06-16 Thread Quentin Wenger


Quentin Wenger  added the comment:

@eric.smith thanks, no problem.

If I can give any advice on this present issue, I would suggest to have the 
ellipsis _inside_ the quote, to make clear that the pattern is being truncated, 
not the match. So instead of

```
<_sre.SRE_Match object; span=(0, 49), 
match='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS'...>
```

as suggested by @Seth.Troisi, I'd suggest

```
<_sre.SRE_Match object; span=(0, 49), 
match='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS...'>
```

--

___
Python tracker 

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



[issue40984] re.compile's repr truncates patterns at 200 characters

2020-06-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

Re-opening this because issue39949 is about match objects, not compiled re 
objects.

Still, I don't think the repr "rule" about being eval-able is hard and fast. 
Although changing the repr to be in brackets wouldn't be unreasonable just to 
drive the point home.

--
resolution: duplicate -> 
stage: resolved -> 
status: closed -> open
superseder: truncating match in regular expression match objects repr -> 

___
Python tracker 

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



[issue39949] truncating match in regular expression match objects repr

2020-06-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

Ah, I see. I missed that this issue was only about match objects. I apologize 
for the confusion.

That being the case, I'll re-open the other issue.

--

___
Python tracker 

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



[issue40990] Make http.server support SSL

2020-06-16 Thread Rémi Lapeyre

New submission from Rémi Lapeyre :

It's a bit outside of its original scope but with more and more application 
requiring HTTPS it is sometime needed even when doing some simple tests or 
local development.

It's quite easy to have an SSL certificate, either auto-signed or using Let's 
Encrypt but configuring Nginx or HAProxy just to serve a local directory on 
localhost is tedious.

I think just wrapping the socket in SSLSocket and adding two flags on the 
command line would be enough?

--
components: Library (Lib)
messages: 371647
nosy: remi.lapeyre
priority: normal
severity: normal
status: open
title: Make http.server support SSL
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Quentin Wenger


Quentin Wenger  added the comment:

The issue with the second variant is that utf-8 is an arbitrary (although 
default) choice.

But: re is doing that same arbitrary choice already in decoding the group names 
into a string, which is my original complaint!

--

___
Python tracker 

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



[issue39949] truncating match in regular expression match objects repr

2020-06-16 Thread Quentin Wenger


Quentin Wenger  added the comment:

For a bit of background, the other issue is about the repr of compiled 
patterns, not match objects.
Please see my argument there about the conformance to repr's doc - merely 
adding an ellipsis would _not_ solve this case.

I have however nothing against the pattern being truncated/ellipsed when inside 
the repr of a match object.

--
nosy: +matpi

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Quentin Wenger


Quentin Wenger  added the comment:

Sorry, b"(?P<\xce\x94>)"

--

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Quentin Wenger

Quentin Wenger  added the comment:

But Δ has no latin-1 representation. So Δ currently cannot be used as a group 
name in bytes regex, although it is a valid Python identifier. So that's a bug.

I mean, if you insist of having group names as strings even for bytes regexes, 
then it is not reasonable to prevent them from going _in_.

b"(??<\xce\x94>)" is a valid utf-8-encoded bytestring, why wouldn't you accept 
it as a valid re pattern?

IMHO, either

- group names from byte regexes should be returned as bytes
- or any utf-8-encoded representation of a valid Python identifier should be 
accepted as a group name of a bytes regex pattern.

--

___
Python tracker 

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



[issue40965] Segfault when importing unittest module via C API

2020-06-16 Thread Christian Heimes


Christian Heimes  added the comment:

It would be helpful if you could provide a C stacktrace. I use gdb to create a 
stacktrace. You may have to install additional debug symbols.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue39949] truncating match in regular expression match objects repr

2020-06-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

There was a discussion in issue40984 that the repr must be eval-able. I don't 
feel very strongly about this, mainly because I don't think anyone ever does 
eval(repr(some_regex)). I'd be slightly sympathetic to wanting the eval to fail 
if the repr had to truncate its output, instead of succeeding because the 
string was still a valid, but different, regex.

--

___
Python tracker 

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



[issue40984] re.compile's repr truncates patterns at 200 characters

2020-06-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

Any change to the repr should take place on the other issue. I don't feel very 
strongly that the repr must be eval-able, but in any event it should be raised 
on issue39949 if you feel strongly about it.

I do think it's reasonable to say that if the repr is truncated, it must not be 
eval-able. Maybe the ellipsis should go outside the quotes, or something else 
to make it fail. But this should be discussed on issue39949.

I'm going to close this.

--
nosy: +eric.smith
resolution:  -> duplicate
status: open -> closed
superseder:  -> truncating match in regular expression match objects repr

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Ma Lin

Ma Lin  added the comment:

In this case, you can only use 'latin1', which directly map one character 
(\u-\u00FF) to/from one byte.

If use 'utf-8', it may map one character to multiple bytes, such as 'Δ' -> 
b'\xce\x94'

'\x94' is an invalid identifier, it will raise an error:

>>> '\xce'.isidentifier()   # '\xce' is 'Î'
True
>>> '\x94'.isidentifier()
False

You may close this issue (I can't close it), we can continue the discussion.

--

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Quentin Wenger

Quentin Wenger  added the comment:

> So b'\xe9' is mapped to \u00e9, it is `é`.

Yes but \xe9 is not strictly valid utf-8, or say not the canonical 
representation of "é". So there is no way to get \xe9 starting from é without 
leaving utf-8. So starting with é as group name, I cannot programmatically 
encode it into a bytes pattern.

> Of course, characters with Unicode code point greater than 0xff are 
> impossible to appear in `bytes`.

But \xce and \x94 are both lower than \xff, yet using \xce\x94 ("Δ".encode()) 
in a group name fails.

According to the doc, the sole constraint on group names is that they have to 
be valid and unique Python identifiers. So this should work:

```
# Δ is a valid identifier
>>> "Δ".isidentifier()
True
>>> Δ = 1
>>> Δ
1
>>> import re
>>> name = "Δ"
>>> re.match(b"(?P<" + name.encode() + b">)", b"")
Traceback (most recent call last):
  File "", line 1, in 
re.match(b"(?P<" + name.encode() + b">)", b"")
  File "/usr/lib/python3.8/re.py", line 191, in match
return _compile(pattern, flags).match(string)
  File "/usr/lib/python3.8/re.py", line 304, in _compile
p = sre_compile.compile(pattern, flags)
  File "/usr/lib/python3.8/sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
  File "/usr/lib/python3.8/sre_parse.py", line 948, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "/usr/lib/python3.8/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
  File "/usr/lib/python3.8/sre_parse.py", line 703, in _parse
raise source.error(msg, len(name) + 1)
re.error: bad character in group name 'Î\x94' at position 4
re.match(b'(?P<\xce\x94>)', b'').groupdict()
```

--

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Ma Lin

Ma Lin  added the comment:

`latin1` is the character set that Unicode code point from \u to \u00ff, 
and the characters are directly mapped from/to bytes.

So b'\xe9' is mapped to \u00e9, it is `é`.

Of course, characters with Unicode code point greater than 0xff are impossible 
to appear in `bytes`.

--

___
Python tracker 

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



[issue37149] link to John Shipman's Tkinter 8.5 documentation fails: website no longer available

2020-06-16 Thread E. Paine


E. Paine  added the comment:

I know I'm a bit late, but I believe the site is now being hosted on a Gtihub 
page:
https://anzeljg.github.io/rin2/book2/2405/docs/tkinter/index.html

I suspect this is another personal project just for historical reference and 
will not be updated, however I would (personally) prefer not to be linked to 
the Wayback Machine.

--
nosy: +epaine

___
Python tracker 

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



[issue37673] Tkinter won't create 5000 check boxes, stops at 1309.

2020-06-16 Thread E. Paine


E. Paine  added the comment:

I tested the demo Python script and also had it stop at 1309. I wrote a small 
tcl script (a simplified version of the Python demo) to test in wish (see 
attached) which stopped at 1058.
It is strange that tkinter stops later than wish, however I would still 
conclude this is a tcl problem not tkinter or Python.

--
nosy: +epaine
Added file: https://bugs.python.org/file49235/tkcheck.tcl

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Quentin Wenger

Quentin Wenger  added the comment:

Of course an inconvenience in my program is not per se the reason to change the 
language. I just wanted to motivate that the current situation gives unexpected 
results.

"\xe9" doesn't look like proper utf-8 to me:

```
>>> "é".encode("latin-1")
b'\xe9'
>>> "é".encode()
b'\xc3\xa9'
```

Let's try another one: how would you go for Δ ("\u0394") as a group name?


```
>>> "Δ".encode()
b'\xce\x94'
>>> "Δ".encode("latin-1")
Traceback (most recent call last):
  File "", line 1, in 
"Δ".encode("latin-1")
UnicodeEncodeError: 'latin-1' codec can't encode character '\u0394' in position 
0: ordinal not in range(256)
>>> re.match(b'(?P<\xce\x94>)', b'').groupdict()
Traceback (most recent call last):
  File "", line 1, in 
re.match(b'(?P<\xce\x94>)', b'').groupdict()
  File "/usr/lib/python3.8/re.py", line 191, in match
return _compile(pattern, flags).match(string)
  File "/usr/lib/python3.8/re.py", line 304, in _compile
p = sre_compile.compile(pattern, flags)
  File "/usr/lib/python3.8/sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
  File "/usr/lib/python3.8/sre_parse.py", line 948, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "/usr/lib/python3.8/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
  File "/usr/lib/python3.8/sre_parse.py", line 703, in _parse
raise source.error(msg, len(name) + 1)
re.error: bad character in group name 'Î\x94' at position 4
>>> re.match(b'(?P<\u0394>)', b'').groupdict()
Traceback (most recent call last):
  File "", line 1, in 
re.match(b'(?P<\u0394>)', b'').groupdict()
  File "/usr/lib/python3.8/re.py", line 191, in match
return _compile(pattern, flags).match(string)
  File "/usr/lib/python3.8/re.py", line 304, in _compile
p = sre_compile.compile(pattern, flags)
  File "/usr/lib/python3.8/sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
  File "/usr/lib/python3.8/sre_parse.py", line 948, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "/usr/lib/python3.8/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
  File "/usr/lib/python3.8/sre_parse.py", line 703, in _parse
raise source.error(msg, len(name) + 1)
re.error: bad character in group name '\\u0394' at position 4
```

--

___
Python tracker 

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



[issue40983] urllib.request.url2pathname() unconditionally uses utf-8 encoding and "replace" error handler

2020-06-16 Thread Manuel Jacob

Change by Manuel Jacob :


--
title: Can’t configure encoding used by urllib.request.url2pathname() -> 
urllib.request.url2pathname() unconditionally uses utf-8 encoding and "replace" 
error handler

___
Python tracker 

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



[issue40980] group names of bytes regexes are strings

2020-06-16 Thread Ma Lin

Ma Lin  added the comment:

> a non-ascii group name will raise an error in bytes, even if encoded

Looks like this is a language limitation:

>>> b'é'
  File "", line 1
SyntaxError: bytes can only contain ASCII literal characters.

No problem if you use escaped character:

>>> re.match(b'(?P<\xe9>)', b'').groupdict()
{'é': b''}

There may be some inconveniences in your program, but IMO there is nothing 
wrong, maybe this issue can be closed.

--

___
Python tracker 

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



  1   2   >