[issue42451] Indicate in the docs that PyTuple_GetItem does not support negative indices

2020-11-26 Thread Yasser Alshalaan


Change by Yasser Alshalaan :


--
keywords: +patch
nosy: +Yasser Alshalaan
nosy_count: 2.0 -> 3.0
pull_requests: +22411
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23529

___
Python tracker 

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



[issue34451] docs: tutorial/introduction doesn't mention toggle of prompts

2020-11-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

- It would apply to PDF renderings or CHM files etc.
+ We wouldn't the the proposed text to be visible in PDF renderings or CHM 
files etc.

--

___
Python tracker 

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



[issue42478] ipaddress.IPv4network.interfaces()

2020-11-26 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm not sure what you mean by iterating over the interfaces in a subnet. Could 
you give an example?

--
nosy: +eric.smith

___
Python tracker 

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



[issue17852] Built-in module _io can lose data from buffered files in reference cycles

2020-11-26 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset c8aaf71dde464c0c351e2f935f87652c3d54 by Volker-Weissmann in 
branch 'master':
 bpo-17852: Doc: Fix the tutorial about closing files (GH-23135)
https://github.com/python/cpython/commit/c8aaf71dde464c0c351e2f935f87652c3d54


--
nosy: +methane

___
Python tracker 

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



[issue17852] Built-in module _io can lose data from buffered files in reference cycles

2020-11-26 Thread Volker Weißmann

Volker Weißmann  added the comment:

The PR below fixed it:

https://github.com/python/cpython/pull/23135

--

___
Python tracker 

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



[issue17852] Built-in module _io can lose data from buffered files in reference cycles

2020-11-26 Thread miss-islington


miss-islington  added the comment:


New changeset 01fcde89d7d56321078be1739e759fece61d0a2b by Miss Islington (bot) 
in branch '3.8':
bpo-17852: Doc: Fix the tutorial about closing files (GH-23135)
https://github.com/python/cpython/commit/01fcde89d7d56321078be1739e759fece61d0a2b


--

___
Python tracker 

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



[issue17852] Built-in module _io can lose data from buffered files in reference cycles

2020-11-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22410
pull_request: https://github.com/python/cpython/pull/23528

___
Python tracker 

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



[issue17852] Built-in module _io can lose data from buffered files in reference cycles

2020-11-26 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 13.0 -> 14.0
pull_requests: +22409
pull_request: https://github.com/python/cpython/pull/23527

___
Python tracker 

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



[issue41818] Lib/pty.py major revision

2020-11-26 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
pull_requests: +22408
pull_request: https://github.com/python/cpython/pull/23526

___
Python tracker 

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



[issue40840] lzma.h file not found building on macOS

2020-11-26 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Yes. If I trust my message from earlier, this issue is resolved. Closing now.

--
resolution:  -> not a bug
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



[issue41818] Lib/pty.py major revision

2020-11-26 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

The reproducer was helpful. https://github.com/python/cpython/pull/23526 should 
fix this issue.

--

___
Python tracker 

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



[issue42478] ipaddress.IPv4network.interfaces()

2020-11-26 Thread Wyko ter Haar


New submission from Wyko ter Haar :

It would be really nice if we could get an iterator just like 
ip_network.hosts() that iterates over the interfaces in a subnet.

--
messages: 381921
nosy: wyko.ter.haar
priority: normal
severity: normal
status: open
title: ipaddress.IPv4network.interfaces()
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue34451] docs: tutorial/introduction doesn't mention toggle of prompts

2020-11-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The toggle option is only in the HTML version with javascript enabled.  It 
would apply to PDF renderings or CHM files etc.

--
nosy: +rhettinger

___
Python tracker 

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



[issue42469] Space in re's {min, max} should raise an error, rather than fail silently

2020-11-26 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
priority: normal -> low
type:  -> behavior
versions: +Python 3.10 -Python 3.9

___
Python tracker 

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



[issue42469] Space in re's {min, max} should raise an error, rather than fail silently

2020-11-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

If this can be fixed without doing brain surgery on the code, it would be nice 
to have this flagged as an error.  People should learn as early as possible 
that regex patterns tend to be unforgiving about extra spaces.

--
nosy: +rhettinger

___
Python tracker 

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



[issue38638] Backtrace of exit phase of context managers

2020-11-26 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Traceback from __exit__ method is misleading

___
Python tracker 

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



[issue42477] ip_interface addition and subtraction changes netmask

2020-11-26 Thread Wyko ter Haar


New submission from Wyko ter Haar :

When increasing IPv4Interface('10.0.0.0/29)'  by 1, I would expect to get 
IPv4Interface('10.0.0.1/29') . Unfortunately, it seems to change the netmask on 
it as well. That seems really unintuitive to me.

For example:
>>> ip_interface('10.0.0.0/24')
IPv4Interface('10.0.0.0/24')
>>>
>>> ip_interface('10.0.0.0/24')+1
IPv4Interface('10.0.0.1/32')

--
messages: 381918
nosy: wyko.ter.haar
priority: normal
severity: normal
status: open
title: ip_interface addition and subtraction changes netmask
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue34451] docs: tutorial/introduction doesn't mention toggle of prompts

2020-11-26 Thread Irit Katriel


Change by Irit Katriel :


--
type:  -> enhancement

___
Python tracker 

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



[issue34451] docs: tutorial/introduction doesn't mention toggle of prompts

2020-11-26 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
versions: +Python 3.10, Python 3.9 -Python 3.4, Python 3.5, 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



[issue31189] README.rst: installing multiple versions: typo

2020-11-26 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +zach.ware
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.7

___
Python tracker 

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



[issue42299] Remove formatter module

2020-11-26 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

A coda on my 'obsolete and superseded' claim: text formatting events have 2 
sources -- the text being displayed and user actions while reading.  formatter 
somewhat mixes these together.

html.parser.HTMLParser generates events from the text in the form of calls to 
handle_xyz methods, where 'xyy is most commonly 'starttag', 'data', 'endtag'.  
HTMLPareser subclasses replace the default 'pass' implementations.  So the idea 
is similar to  formatter.NullFormatter.  IDLE uses the tkinter Text widget as 
the writer instance for its HTMLParser subclass.  Responses to events may 
depend on user settings, which may be changed by user events.

For a GUI app, user events are handled by the GUI framework and may or mayy not 
require user coding to handle.

--

___
Python tracker 

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



[issue31248] method wrapper type has invalid __name__/__qualname__ 'method-wrapper'

2020-11-26 Thread Irit Katriel


Irit Katriel  added the comment:

Why is this a problem?

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

___
Python tracker 

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



[issue27259] [array doc] Possible missing deprecation warnings?

2020-11-26 Thread Irit Katriel


Change by Irit Katriel :


--
components: +Library (Lib)
title: Possible missing deprecation warnings? -> [array doc]  Possible missing 
deprecation warnings?
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue26454] add support string that are not inherited from PyStringObject

2020-11-26 Thread Irit Katriel


Irit Katriel  added the comment:

I don't understand what the issue is. Can you clarify?

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

___
Python tracker 

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



[issue40840] lzma.h file not found building on macOS

2020-11-26 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Is this issue resolved?

--

___
Python tracker 

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



[issue42476] Allow cross compiling python for macos-arm64 from macos-x86_64

2020-11-26 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I've added some review comments to the PR. 

Note that cross building like this will not be as well tested by us as regular 
builds.

--
components: +macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue25479] Increase unit test coverage for abc.py

2020-11-26 Thread Irit Katriel


Irit Katriel  added the comment:

The patch needs to be converted to a github PR.

--
keywords: +easy (C)
nosy: +iritkatriel
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue42475] wrongly cache pattern by re.compile

2020-11-26 Thread Matthew Barnett


Matthew Barnett  added the comment:

That behaviour has nothing to do with re.

This line:

samples = filter(lambda sample: not pttn.match(sample), data)

creates a generator that, when evaluated, will use the value of 'pttn' _at that 
time_.

However, you then bind 'pttn' to something else.

Here's a simple example:

>>> x = 1
>>> func = lambda: print(x)
>>> func()
1
>>> x = 2
>>> func()
2

A workaround is to capture the current value with a default argument:

>>> x = 1
>>> func = lambda x=x: print(x)
>>> func()
1
>>> x = 2
>>> func()
1

--
resolution:  -> not a bug
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



[issue42471] Slowdown in socket tests noticed since Py3.8

2020-11-26 Thread Bert JW Regeer


Bert JW Regeer  added the comment:

Ned: You are correct, I hadn't even considered that as a potential issue. Added 
a context to grab the fork multiprocessing context and we are back to the speed 
it was before.

This slowdown is pretty huge for just changing the way the process is forked.

--

___
Python tracker 

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



[issue42470] DeprecationWarning triggers for sequences which happen to be sets as well

2020-11-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

+0 

Do you want to submit a PR for this?

Some thoughts:

* The current logic matches the logic before the warning was added.
* The proposed logic matches what the code will do after the
  deprecation period (it will only check for non-sequences).
* There is some value in the warning in that it lets you know an
  inefficient code path is being used (i.e. the conversion to a tuple).
* The proposed logic doesn't just change the warning, it changes
  what actually happens to the data.  IMO the change is for the
  better, but it is a behavior change and could potentially cause
  a failure in someone's code.
* The case of an object that is both a sequence and a set is
  likely very rare.

--
nosy: +tim.peters

___
Python tracker 

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



[issue42476] Allow cross compiling python for macos-arm64 from macos-x86_64

2020-11-26 Thread Isuru Fernando


Change by Isuru Fernando :


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

___
Python tracker 

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



[issue42476] Allow cross compiling python for macos-arm64 from macos-x86_64

2020-11-26 Thread Isuru Fernando


New submission from Isuru Fernando :

Only a few changes are needed and I will send a Pull request.

This was used for providing macos-arm64 builds for conda where we are using 
cross compiling exclusively for all macos-arm64 builds

--
components: Build
messages: 381908
nosy: isuruf, willingc
priority: normal
severity: normal
status: open
title: Allow cross compiling python for macos-arm64 from macos-x86_64
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



[issue42475] wrongly cache pattern by re.compile

2020-11-26 Thread ProFatXuanAll


New submission from ProFatXuanAll :

When I run the following code, I expected to get output result `['i am next 
line with [unk]']`, but instead I get the original list in `data`.

Code snippet

```py
import re

data = [
'= hello =',
'i am next line with ',
]

pttn = re.compile(r'=.*=')
samples = filter(lambda sample: not pttn.match(sample), data)

pttn = re.compile(r'')
samples = map(lambda sample: pttn.sub('[unk]', sample), samples)

print(list(samples))
```

I suspect that is the cache provide by `re.compile` cause the problem.
The `sub` function in `map` is somehow begin link to the first `pttn`.

If I instead rename the second `pttn` to `pttn2`, then it work magically, but 
this is not expected.

--
components: Regular Expressions
files: rebug.py
messages: 381907
nosy: ProFatXuanAll, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: wrongly cache pattern by re.compile
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49625/rebug.py

___
Python tracker 

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



[issue42474] improve test coverage for TracebackException's __eq__

2020-11-26 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue42474] improve test coverage for TracebackException's __eq__

2020-11-26 Thread Irit Katriel


New submission from Irit Katriel :

Currently there are no tests for comparison between non-equal instances of 
traceback.TracebackException, so changing it's __eq__ to return True instead of 
self.__dict__ == other.__dict__ would not break any tests.

--
assignee: iritkatriel
components: Tests
messages: 381906
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: improve test coverage for TracebackException's __eq__
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



[issue42473] re.sub ignores flag re.M

2020-11-26 Thread Matthew Barnett


Matthew Barnett  added the comment:

Not a bug.

Argument 4 of re.sub is the count:

sub(pattern, repl, string, count=0, flags=0)

not the flags.

--
nosy: +mrabarnett
resolution:  -> not a bug
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



[issue42471] Slowdown in socket tests noticed since Py3.8

2020-11-26 Thread Ned Deily

Ned Deily  added the comment:

Do your tests use the multiprocessing module? As of 3.8, the default start 
method for multiprocessing on macOS was changed from “fork” to “spawn”:

https://docs.python.org/3.8/library/multiprocessing.html#contexts-and-start-methods

--
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue42472] security hole in eval()

2020-11-26 Thread STINNER Victor


STINNER Victor  added the comment:

> The specification specifically allows for the restriction of access to 
> globals via the second argument to eval.

The Python language reference doesn't provide any warranty like that.
https://docs.python.org/dev/library/functions.html#eval

I close the issue as "not as bug".

All previous attempts to "sandbox" Python code in Python have failed. The 
correct way is to run Python in a sandbox. Not the opposite.

> https://lwn.net/Articles/574215/ 

This one was my attempt for example ;-)

--
resolution:  -> not a bug
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



[issue41625] Add splice() to the os module

2020-11-26 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-11-26 Thread STINNER Victor


STINNER Victor  added the comment:

> ./Modules/posixmodule.c:10429:15: error: implicit declaration of function 
> 'splice'; did you mean 'plock'? [-Werror=implicit-function-declaration]

Is it possible that posixmodule.c lacks an #include to get the function on AIX?

On AIX 7.1, man splice says:

   #include 
   #include 
   int splice(socket1, socket2, flags)
   int socket1, socket2;
   int flags;

posixmodule.c doesn't include it on AIX:

#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
#  ifdef HAVE_SYS_SOCKET_H
#include 
#  endif
#endif


Michael: Would you mind to try building the master branch of Python with 
attached socket.patch? (on the worker where Python no longer builds)

--
Added file: https://bugs.python.org/file49624/socket.patch

___
Python tracker 

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



[issue41818] Lib/pty.py major revision

2020-11-26 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



[issue42473] re.sub ignores flag re.M

2020-11-26 Thread Jérôme Laurens

New submission from Jérôme Laurens :

Test code:
```
import re
test='''012345678
 
012345678
'''
pattern = r'^\s+?$'
m = re.search(pattern, test, re.M)
if m:
print(f'TEST FOUND "{m.span()}"')

def replace(m):
print(f'TEST REMOVE {m.span()}')
return ''

test = re.sub(pattern, replace, test, re.M)
m = re.search(pattern, test, re.M)
if m:
print(f'TEST STILL THERE "{m.span()}"')

print('COMPILE PATTERN FIRST')
pattern_re = re.compile(pattern, re.M)
m = re.search(pattern_re, test)
if m:
print(f'TEST FOUND "{m.span()}"')

def replace(m):
print(f'TEST REMOVE {m.span()}')
return ''

test = re.sub(pattern_re, replace, test)
m = re.search(pattern_re, test)
if m:
print(f'TEST STILL THERE "{m.span()}"')
```

Actual output:

TEST FOUND "(10, 19)"
TEST STILL THERE "(10, 19)"
COMPILE PATTERN FIRST
TEST FOUND "(10, 19)"
TEST REMOVE (10, 19)

This is an inconsistency between re.search and re.sub. Either this is a bug in 
the code or in the documentation.

--
components: IO
messages: 381901
nosy: jlaurens
priority: normal
severity: normal
status: open
title: re.sub ignores flag re.M
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue42472] security hole in eval()

2020-11-26 Thread Christian Heimes


Christian Heimes  added the comment:

Your assumption is incorrect. The eval() does not promise that default builtins 
cannot be access through other means. The behavior has been discussed several 
times and at great length over the past decade.

--

___
Python tracker 

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



[issue42466] asyncio loop.getaddrinfo raises RuntimeError

2020-11-26 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Because it did work in a gray area.
The finalization logic has slightly changed, some tricks that were working 
before now fails.
Sure, other undocumented tricks start working :)

The rule of thumb: please stop and close the asyncio loop before exiting the 
program. This rule allows for avoiding situations like this.

--

___
Python tracker 

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



[issue42472] security hole in eval()

2020-11-26 Thread Chris Drake


Chris Drake  added the comment:

The specification specifically allows for the restriction of access to globals 
via the second argument to eval.

While Christian and Victor make interesting, albeit suicidal, comments and 
references to other efforts, the fact remains that this is a violation of the 
standard, and is an exploitable security issue.

It's worth noting that the 1980's are long over now - people take security 
seriously these days, even when it's inconvenient.

The fix seems ridiculously trivial for what it's worth; introduce a flag that 
honors the intent of the second argument.

--

___
Python tracker 

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



[issue42466] asyncio loop.getaddrinfo raises RuntimeError

2020-11-26 Thread Giacomo Caironi


Giacomo Caironi  added the comment:

Ok but then why does it work in python3.8 and not in python 3.9?

--

___
Python tracker 

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



[issue42466] asyncio loop.getaddrinfo raises RuntimeError

2020-11-26 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Because you have `test.start()` and immediately finish the script.

The interpreted goes to *shutdown* state and implicitly waits for `test.join()` 
because the test thread is not a daemon.

--

___
Python tracker 

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



[issue42472] security hole in eval()

2020-11-26 Thread STINNER Victor


STINNER Victor  added the comment:

I suggest you to read https://python-security.readthedocs.io/security.html 
about the Python security model. In short, as soon as you let users to execute 
arbitrary Python code, they get a full access to the machine.

If you want to restrict access, you must run Python inside a restricted 
container (or any sandbox).

--
nosy: +vstinner

___
Python tracker 

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



[issue42472] security hole in eval()

2020-11-26 Thread Christian Heimes


Christian Heimes  added the comment:

Would you care to explain why this should not work and how this behavior is in 
violation of the language specification?

It is perfectly valid expression. From a security perspective it may be an 
undesired feature. However Python does neither claim nor promise that eval is 
secure, see articel https://lwn.net/Articles/574215/ for more information on a 
failed attempt to sandbox Python. There is also ast.literal_eval() function, 
which provides limit evaluation of simple expressions.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue42466] asyncio loop.getaddrinfo raises RuntimeError

2020-11-26 Thread Giacomo Caironi


Giacomo Caironi  added the comment:

Why do you say that `getaddrinfo()` is called at the interpreter shutdown 
state? On my machine it works and the output is [(, 
, 6, '', ('216.58.208.132', 8333)), 
(, , 17, '', 
('216.58.208.132', 8333)), (, , 0, '', ('216.58.208.132', 8333)), (, 
, 6, '', ('2a00:1450:4002:805::2004', 8333, 0, 0)), 
(, , 17, '', 
('2a00:1450:4002:805::2004', 8333, 0, 0)), (, 
, 0, '', ('2a00:1450:4002:805::2004', 8333, 0, 0))], 
which is printed on the console

--

___
Python tracker 

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



[issue42472] security hole in eval()

2020-11-26 Thread Chris Drake


New submission from Chris Drake :

This should not work:-

python3.7 -c  
'print(eval("().__class__.__base__.__subclasses__()[-1].__init__.__globals__",{"__builtins__":
 {}},{"__builtins__": {}}))'

and should be properly fixed.

--
messages: 381892
nosy: cryptophoto
priority: normal
severity: normal
status: open
title: security hole in eval()
type: security
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



[issue42392] remove the 'loop' parameter from __init__ in all classes in asyncio.locks

2020-11-26 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


--
pull_requests: +22405
pull_request: https://github.com/python/cpython/pull/23521

___
Python tracker 

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



[issue42471] Slowdown in socket tests noticed since Py3.8

2020-11-26 Thread Bert JW Regeer


New submission from Bert JW Regeer :

I am being fairly vague here, but it is mainly because I don't know the best 
way to reduce the test cases down to pinpoint the problem.

I maintain Waitress, a pure Python HTTP server, and ever since Python 3.8 
there's been a marked slowdown of the functional tests.

Python 3.6 on my MacBook Pro M1 Rosetta: 15.91s to run the entire test suite, 
similar slow tests as Py37. So not included.

Python 3.7 on my MacBook Pro M1 Rosetta: 15.57s to run the entire test suite

Slowest tests on Py37 is:

3.10s call tests/test_functional.py::SleepyThreadTests::test_it
1.01s call 
tests/test_channel.py::TestHTTPChannelLookahead::test_client_disconnect
0.41s call tests/test_wasyncore.py::DispatcherWithSendTests::test_send
0.17s call 
tests/test_wasyncore.py::TestAPI_UseIPv6Poll::test_handle_close_after_conn_broken
0.11s call tests/test_wasyncore.py::TestAPI_UseIPv4Select::test_handle_read
0.11s call 
tests/test_wasyncore.py::TestAPI_UseIPv4Select::test_handle_close_after_conn_broken
0.11s call 
tests/test_wasyncore.py::TestAPI_UseIPv4Poll::test_handle_close_after_conn_broken
0.11s call 
tests/test_wasyncore.py::TestAPI_UseUnixSocketsPoll::test_handle_close_after_conn_broken
0.11s call 
tests/test_wasyncore.py::TestAPI_UseIPv6Select::test_handle_close_after_conn_broken
0.11s call tests/test_wasyncore.py::TestAPI_UseIPv4Select::test_handle_close

Python 3.8 on my MacBook Pro M1 Rosetta: 44.33 seconds to run the entire test 
suite

3.34s call tests/test_functional.py::SleepyThreadTests::test_it
1.01s call 
tests/test_channel.py::TestHTTPChannelLookahead::test_client_disconnect
0.41s call tests/test_wasyncore.py::DispatcherWithSendTests::test_send
0.40s call 
tests/test_functional.py::TcpInternalServerErrorTests::test_before_start_response_http_11_close
0.36s call 
tests/test_functional.py::TcpInternalServerErrorTests::test_before_start_response_http_11
0.35s call 
tests/test_functional.py::UnixWriteCallbackTests::test_no_content_length
0.34s call 
tests/test_functional.py::TcpInternalServerErrorTests::test_after_write_cb
0.33s call 
tests/test_functional.py::TcpInternalServerErrorTests::test_after_start_response_http11_close
0.32s call 
tests/test_functional.py::TcpFileWrapperTests::test_filelike_nocl_http10
0.32s call 
tests/test_functional.py::TcpFileWrapperTests::test_filelike_http10

Python 3.9 on my MacBook Pro M1 Rosetta: 41.93 seconds

3.28s call tests/test_functional.py::SleepyThreadTests::test_it
1.01s call 
tests/test_channel.py::TestHTTPChannelLookahead::test_client_disconnect
0.41s call tests/test_wasyncore.py::DispatcherWithSendTests::test_send
0.36s call tests/test_functional.py::TcpWriteCallbackTests::test_short_body
0.33s call 
tests/test_functional.py::TcpFileWrapperTests::test_notfilelike_nocl_http10
0.32s call 
tests/test_functional.py::TcpEchoTests::test_chunking_request_without_content
0.32s call tests/test_functional.py::TcpEchoTests::test_date_and_server
0.31s call 
tests/test_functional.py::TcpBadContentLengthTests::test_long_body
0.30s call 
tests/test_functional.py::TcpEchoTests::test_broken_chunked_encoding_missing_chunk_end
0.30s call 
tests/test_functional.py::TcpTooLargeTests::test_request_body_too_large_with_wrong_cl_http10

This is very visible too in the test times on Github actions:

https://github.com/Pylons/waitress/runs/1335343659?check_suite_focus=true 
(Python 3.7, running tox takes 40 seconds)

https://github.com/Pylons/waitress/runs/1335343690?check_suite_focus=true 
(Python 3.8, running tox takes 3m and 42seconds)

Although GitHub actions are not always reliable since it is shared 
infrastructure and you never know who your neighbors are, but the same issue 
holds across all of the Mac devices I own (2017 MacBook Pro i7, 2012 Mac Mini 
i7). Just as an extra data point, my 2017 MacBook Pro runs the py39 tests in 67 
seconds, and the py37 tests in 26 seconds.

The problem is that I don't know where to begin attempting figure out what is 
going on. So I am shooting my shot here in the bug tracker. How can I help 
debug this/track this down so that we can get rid of the regression and speed 
things back up?

Open source project: https://github.com/Pylons/waitress
Uses pytest to run tests, tox is the easiest way to accomplish this.

--
messages: 381891
nosy: X-Istence
priority: normal
severity: normal
status: open
title: Slowdown in socket tests noticed since Py3.8
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



[issue41332] connect_accepted_socket() missing from AbstractEventLoop

2020-11-26 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

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



[issue41332] connect_accepted_socket() missing from AbstractEventLoop

2020-11-26 Thread Andrew Svetlov

Andrew Svetlov  added the comment:


New changeset e3ef4d7f653976ac0ccacc4e3fde06bf0e0f139b by Alex Grönholm in 
branch 'master':
bpo-41332: Added missing connect_accepted_socket() to AbstractEventLoop 
(GH-21533)
https://github.com/python/cpython/commit/e3ef4d7f653976ac0ccacc4e3fde06bf0e0f139b


--

___
Python tracker 

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



[issue41562] StreamReaderProtocol inheritance

2020-11-26 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

You are right, but the existing inheritance is also correct (while a little 
redundant).

Sorry, I don't think we should do anything: don't fix if not broken.

--
resolution:  -> not a bug
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



[issue41625] Add splice() to the os module

2020-11-26 Thread Michael Felt


Michael Felt  added the comment:

This is still broken.

Since this was included in master - the AIX buildbot is failing to compile 
(https://buildbot.python.org/all/#/builders/438/builds/391 and 
https://buildbot.python.org/all/#/builders/302/builds/377)

Strangely enough - the first bot continues to fail compile at the same location 
- while the second bot (running in a different environment) starting passing 
compile and all tests starting with 
https://buildbot.python.org/all/#/builders/302/builds/406.

Note: bot 1 is using what I call (personal opinion) a mixed environment with 
some libraries coming from OSS packages and some from IBM AIX. bot 2 - relies 
on IBM AIX libraries.

++
Note: manual build on same system as bot 1 using gcc - gives same error:

aixtools@gcc119:[/home/aixtools/cpython/cpython-master]make V=1
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv 
-O3 -Wall  -O  -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Werror=implicit-function-declaration 
-fvisibility=hidden  -I./Include/internal  -I. -I./Include-DPy_BUILD_CORE  
-DABIFLAGS='""'-o Python/sysmodule.o ./Python/sysmodule.c
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv 
-O3 -Wall  -O  -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Werror=implicit-function-declaration 
-fvisibility=hidden  -I./Include/internal  -I. -I./Include-DPy_BUILD_CORE 
-o Modules/config.o Modules/config.c
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 
-Wall  -O  -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Werror=implicit-function-declaration 
-fvisibility=hidden  -I./Include/internal  -I. -I./Include
-DPy_BUILD_CORE_BUILTIN  -DPy_BUILD_CORE_BUILTIN -I./Include/internal -c 
./Modules/posixmodule.c -o Modules/posixmodule.o
./Modules/posixmodule.c: In function 'os_splice_impl':
./Modules/posixmodule.c:10429:15: error: implicit declaration of function 
'splice'; did you mean 'plock'? [-Werror=implicit-function-declaration]
 ret = splice(src, p_offset_src, dst, p_offset_dst, count, flags);
   ^~
   plock
cc1: some warnings being treated as errors
make: 1254-004 The error code from the last command is 1.

* On same system, using xlc-v13, the build completes normally.

--
nosy: +Michael.Felt

___
Python tracker 

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



[issue42347] loop.call_exception_handler documentation is lacking

2020-11-26 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Pull Request is welcome!

--

___
Python tracker 

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



[issue42470] DeprecationWarning triggers for sequences which happen to be sets as well

2020-11-26 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



[issue42413] Replace custom exceptions for timeouts with TimeoutError

2020-11-26 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Pull Request https://github.com/python/cpython/pull/23520/ applies the 
discussed change to both asyncio and concurrent.futures.

I did the minimally invasive change, libraries still use `asyncio.TimeoutError` 
and `concurrent.futures.TimeoutError` internally but both names are aliases now.

--

___
Python tracker 

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



[issue42413] Replace custom exceptions for timeouts with TimeoutError

2020-11-26 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue42470] DeprecationWarning triggers for sequences which happen to be sets as well

2020-11-26 Thread Xavier Morel


New submission from Xavier Morel :

In 3.9, using `random.sample` on sets triggers

DeprecationWarning: Sampling from a set deprecated
since Python 3.9 and will be removed in a subsequent version.

*However* it also triggers on types which implement *both* Sequence and Set, 
despite Sequence on its own being fine.

The issue is that it first checks for Set and triggers a warning, and only then 
checks that the input is a sequence:

if isinstance(population, _Set):
_warn('Sampling from a set deprecated\n'
  'since Python 3.9 and will be removed in a subsequent 
version.',
  DeprecationWarning, 2)
population = tuple(population)
if not isinstance(population, _Sequence):
raise TypeError("Population must be a sequence.  For dicts or sets, 
use sorted(d).")

the check should rather be:

if not isinstance(population, _Sequence):
if isinstance(population, _Set):
_warn('Sampling from a set deprecated\n'
  'since Python 3.9 and will be removed in a subsequent 
version.',
  DeprecationWarning, 2)
population = tuple(population)
else:
raise TypeError("Population must be a sequence.  For dicts or 
sets, use sorted(d).")

this also only incurs a single instance check for `_Sequence` types instead of 
two.

--
messages: 381885
nosy: xmorel
priority: normal
severity: normal
status: open
title: DeprecationWarning triggers for sequences which happen to be sets as well
versions: Python 3.9

___
Python tracker 

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



[issue42413] Replace custom exceptions for timeouts with TimeoutError

2020-11-26 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
components: +Library (Lib), asyncio

___
Python tracker 

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



[issue42413] Replace custom exceptions for timeouts with TimeoutError

2020-11-26 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
title: Replace custom exception socket.timeout with TimeoutError -> Replace 
custom exceptions for timeouts with TimeoutError

___
Python tracker 

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



[issue42466] asyncio loop.getaddrinfo raises RuntimeError

2020-11-26 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Your snippet exits just after starting.
`getaddrinfo()` is called at the interpreter shutdown state.

I'm not sure that do you expect to get here.  We can put some effort and raise 
an error with another message but cannot make the example working.

I suggest just closing the issue; nothing to do here.

--

___
Python tracker 

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