[issue38753] AsyncMock not cited as new in 3.8

2019-11-08 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +lisroach, xtreak

___
Python tracker 

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



[issue38753] AsyncMock not cited as new in 3.8

2019-11-08 Thread John Belmonte


New submission from John Belmonte :

AsyncMock appears to be new in Python 3.8, but doc is missing info on when it 
was introduced.

https://docs.python.org/3.8/library/unittest.mock.html#unittest.mock.AsyncMock

--
assignee: docs@python
components: Documentation
messages: 356290
nosy: John Belmonte, docs@python
priority: normal
severity: normal
status: open
title: AsyncMock not cited as new in 3.8
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



[issue38692] add a pidfd child process watcher

2019-11-08 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

It seems like systemd-nspawn is just breaking everything: 
https://sourceware.org/ml/libc-alpha/2019-11/msg00277.html

--

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-08 Thread Kyle Stanley


Kyle Stanley  added the comment:

[aeros:~/repos/benjaminp-cpython]$ ./python -m test test_posix -F  
(asyncio-pidfd) 
...
0:08:52 load avg: 1.89 [1008] test_posix
0:08:52 load avg: 2.22 [1009] test_posix
...

1008 tests OK.

Total duration: 8 min 52 sec
Tests result: INTERRUPTED

--

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-08 Thread Kyle Stanley


Kyle Stanley  added the comment:

> [aeros:~/repos/benjaminp-cpython]$ ./python -m test test_pty -F
> (asyncio-pidfd) 
...
0:01:31 load avg: 1.57 [2506] test_pty
0:01:31 load avg: 1.57 [2507] test_pty

Oops, looks like I copied the wrong results of a separate test I was running 
earlier. I'll post the results of ~1000 iterations of test_posix below, once it 
is completed again.

--

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-08 Thread Kyle Stanley


Kyle Stanley  added the comment:

> I got a failure in newly added test_pidfd_open:

> I'm running kernel 5.3.7-x86_64-linode130 with Arch Linux.

> I think you must still be experiencing some sort of sandboxing. I don't know 
> how else you would get an EPERM out of pidfd_open.

I believe Benjamin is correct. On a native install of Arch Linux with kernel 
5.3.7 (using latest updates from the official repos), I received no failures in 
test_posix. 

[aeros:~/repos/benjaminp-cpython]$ ./python -m test test_posix 
(asyncio-pidfd) 
0:00:00 load avg: 1.86 Run tests sequentially
0:00:00 load avg: 1.86 [1/1] test_posix

== Tests result: SUCCESS ==

1 test OK.

Total duration: 544 ms
Tests result: SUCCESS

To confirm there weren't intermittent failures, I also ran test_posix 
indefinitely, sending SIGINT after ~2500 iterations. No failures occurred:

[aeros:~/repos/benjaminp-cpython]$ ./python -m test test_pty -F
(asyncio-pidfd) 
...
0:01:31 load avg: 1.57 [2506] test_pty
0:01:31 load avg: 1.57 [2507] test_pty
^C

== Tests result: INTERRUPTED ==
Test suite interrupted by signal SIGINT.

2506 tests OK.

Total duration: 1 min 31 sec
Tests result: INTERRUPTED

It seems that the issue is likely specific to Chih-Hsuan Yen's environment.

--

___
Python tracker 

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



[issue38681] 2to3 Conversion Result using BlankLine() can be Syntactically Incorrect

2019-11-08 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue38747] Slowly introduce a subset of Jupyter console (IPython) features into CPython command line interactive mode

2019-11-08 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Marco: there's no need for these to be "slowly" introduced. If the features are 
worth having in the default REPL, they're worth having as soon as possible, 
without us artificially slowing the process down. It will be hard enough to get 
somebody willing and able to do the work without telling them to dribble the 
features out slowly as well. Trust me on this, the hard part of Python 
development is getting feature requests implemented *at all*, not that they 
come too quickly!

You might like to try building these features on top of the pure-Python 
interactive REPL:

https://docs.python.org/3/library/code.html

or perhaps try adding them to IDLE.

If and when you have something positive to show, you could try re-opening this 
task with a concrete proof-of-concept using the code module, or perhaps a PR 
for IDLE.

--

___
Python tracker 

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



[issue31542] pth files in site-packages of venvs are executed twice

2019-11-08 Thread wim glenn


Change by wim glenn :


--
nosy: +wim.glenn

___
Python tracker 

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



[issue38747] Slowly introduce a subset of Jupyter console (IPython) features into CPython command line interactive mode

2019-11-08 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Terry, I think you were extremely over-eager, almost aggressively so, to close 
this feature request, especially since your reasons given are rather bogus: 
IPython isn't based on a GUI, it works in a text mode console too, including on 
Windows.

https://ipython.readthedocs.io/en/stable/overview.html

You say "there is no need to completely rewrite current text-based interactive 
mode". You are probably right: there probably is *no need* to completely 
rewrite the current implementation to add at least some, if not all, of the 
requested features.

For example, I would be shocked if it wasn't absolutely trivial for the current 
implementation to add auto-indenting following a colon. That feature alone 
would be a win for usability.

Given that Brett already said that the main obstacle to this feature request 
was lack of somebody interested and able to do the work (as opposed to a policy 
that we want the default REPL to be weak and unfriendly), I think you were 
premature in closing this so quickly. It's not like it has been languishing for 
years.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue38747] Slowly introduce a subset of Jupyter console (IPython) features into CPython command line interactive mode

2019-11-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

In interactive mode, python.exe interacts with a console/(dumb terminal) 
through the std streams using \n as a special character  It gets input from 
stdin, send output to stdout or errors to stderr.  The terminal, not python, 
handles line editing and history retrieval.  Once a statement is entered and 
executed, python has no memory of it.

On Linux, one can use readline and ncurses modules for somewhat enhances 
interaction.

IPython is GUI-based.  Python already come with a GUI-based IDE, IDLE, which 
has many of the features you list - autoindent, statement history, save, line 
numbers in the editor, syntax coloring, and some source inspection.  Code with 
blank lines within statement can be pasted into an editor window and run either 
with or without clearing the shell workspace.

There are other alternatives with similar features, but this is not the place 
to discuss them.  The point is that there is no need to completely rewrite 
current text-based interactive mode.

--
nosy: +terry.reedy
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



[issue38746] HTML5 named character references not consistent

2019-11-08 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Questions should usually be asked on python-list or elsewhere.

To answer, html5 was created from
https://html.spec.whatwg.org/multipage/named-characters.html
with these issues and patches.
#3 dc44f55cc9dc1d016799362c344958baab328ff4
   518dbfd7b5a4614b095befc62d1abf1588c7c14a
#16245 e6e96eea5157650be77306b15b28bc815e14c2f3

The peculiarities in the dict keys reflect peculiarities in the standard. For 
instance, msg163706 of #3 says "the standard allows some charref to end 
without a ';', but not all of them."

I am leaving this open to add a link to the source file both in entities.py and 
the doc.  It shows examples of the entities.  A new one for me is smashp;   
U+02A33 ⨳.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, terry.reedy
resolution:  -> not a bug
stage:  -> needs patch
versions: +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



[issue38740] Line count mismatch between open() vs sys.stdin api calls

2019-11-08 Thread Thamme Gowda


Change by Thamme Gowda :


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



[issue16245] Update html.entities.html5 dictionary and parseentities.py

2019-11-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

According to git blame, the html5 dict in 
https://github.com/python/cpython/blob/master/Lib/html/entities.py has changed 
in 7 years.  On the other hand, the standard on which it is based, 
https://html.spec.whatwg.org/multipage/named-characters.html, was last revised 
yesterday, and I presume several other times since.  On the third hand, I just 
ran the update script and there was no change to entities.py, so maybe is has 
been run with every release.

Should a comment be added to the file listing the unicode source and the update 
script?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue38752] __init__ taking out of context variables

2019-11-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

Also: you're statement that bar was initialized to "some value" isn't true: you 
didn't use attr1 in your __init__ method, so "some value" was never used.

If you're confused, I suggest you ask on the python-list or tutor mailing 
lists. More info here: https://mail.python.org/mailman/listinfo

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



[issue38752] __init__ taking out of context variables

2019-11-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

This isn't a bug, it's how the language works. You're not forced to use the 
parameters to a function (in this case __init__), and you can reference any 
variable, including a global.

--
components:  -asyncio
nosy: +eric.smith

___
Python tracker 

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



[issue38746] HTML5 named character references not consistent

2019-11-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue38740] Line count mismatch between open() vs sys.stdin api calls

2019-11-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Should this be closed as 'not a bug'?

--
nosy: +terry.reedy
title: Line count mis match between open() vs sys.stdin api calls -> Line count 
mismatch between open() vs sys.stdin api calls

___
Python tracker 

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



[issue38752] __init__ taking out of context variables

2019-11-08 Thread Sebastian Bevc


New submission from Sebastian Bevc :

Hello,

This is my first bug report. While doing some homework i came to realize that 
the __init__ of a class was taking out of context variables.

class Foo(object):
  def __init__(self, attr1):
self.out_of_context = out_of_context


# Raises NameError as it is expected
foo = Foo('some attr')

# 'bar' is bounded to 'out_of_context' although it was initialized
# with value 'some value'
out_of_context = 'bar'
foo = Foo('some value')
print(foo.out_of_context')  # prints 'bar'

--
components: asyncio
messages: 356277
nosy: asvetlov, sebasbeco, yselivanov
priority: normal
severity: normal
status: open
title: __init__ taking out of context variables
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue38751] Document maximum JSON depth or remove it.

2019-11-08 Thread Борис Верховский

New submission from Борис Верховский :

import json

foo = {}

for i in range(1000):
json.dumps(foo)
print(i)
foo = {'bar': foo}


Will error at 994. At a minimum this magic number should be documented, but it 
would be better if the json library could handle arbitrarily nested JSON or 
have a configurable limit.

https://github.com/lovasoa/bad_json_parsers

--
components: Library (Lib)
messages: 356276
nosy: boris
priority: normal
severity: normal
status: open
title: Document maximum JSON depth or remove it.
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



[issue38734] Python 3.7 and 3.8 in Windows Store do not start under git bash

2019-11-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

['crash' means something like Windows 'your program has quit running' box.]

Do other Windows Store 'apps' run from bash? (Or from Command Prompt or Power 
Shell?)

For an immediate solution, install Python normally, as a command-line program, 
with the python.org Windows installer.

Terry@Tejarex MINGW64 ~
$ python
Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

Terry@Tejarex MINGW64 ~
$ py
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

Terry@Tejarex MINGW64 ~
$ py -m idlelib
[IDLE 3.8 shell runs]

You should then be able to run 'py -x.y pip install ...' to install to python 
x.y.

Steve, can and will you make store python runnable under bash or should this be 
closed?

--
nosy: +terry.reedy
type: crash -> behavior

___
Python tracker 

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



[issue27465] IDLE:Make help source menu entries unique and sorted.

2019-11-08 Thread Zackery Spytz


Zackery Spytz  added the comment:

I have created a pull request for this issue.  Please consider taking a look.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue38688] Python 3.8 regression: endless loop in shutil.copytree

2019-11-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +3.8regression
stage:  -> needs patch
type: crash -> behavior

___
Python tracker 

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



[issue38681] 2to3 Conversion Result using BlankLine() can be Syntactically Incorrect

2019-11-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue38678] TypeError for Tutorial 10.3 Example 2

2019-11-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Crash means 'python stopped erroneously without a traceback'. 

Same exception in 3.8 and 3.9.  Argparse uses None for a count of 0.  I 
consider this a bug.  If not changed, it should be documented.  As argparse is, 
the example needs to recode None to 0.  (Or, it could add '-v' to sys.argv.)  
With proper line wrapping, the result could be

import argparse
from getpass import getuser
parser = argparse.ArgumentParser(description='An argparse example.')
parser.add_argument('name', nargs='?', default=getuser(),  # wrap
help='The name of someone to greet.')
parser.add_argument('--verbose', '-v', action='count')
args = parser.parse_args()  # new
args.verbose = 0 if args.verbose is None else args.verbose
greeting = (["Hi", "Hello", "Greetings! its very nice to meet you"] #wrap
[args.verbose % 3])
print(f'{greeting}, {args.name}')

--
nosy: +terry.reedy
stage:  -> needs patch
title: TypeError raised trying to run TPT 10.3 Example 2 in Python 3.4.3 -> 
TypeError for Tutorial 10.3 Example 2
type: crash -> behavior

___
Python tracker 

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



[issue38679] Scipy and Scikit learn library installation issues

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



[issue38673] REPL shows continuation prompt (...) when comment or space entered

2019-11-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Entering 'pass' or a completely blank line results in a new primary prompt, at 
least on Windows. The Windows REPL otherwise prints ... even for effectively 
blank lines.  IDLE usually prints a new prompt for effectively blank lines.

>>> 
>>> #a
>>> # a
>>>  #a
>>>

I agree that these look better.  This behavior comes from 
code.InteractiveInterpreter and ultimately codeop.

def _maybe_compile(compiler, source, filename, symbol):
# Check for source consisting of only blank lines and comments
for line in source.split("\n"):
line = line.strip()
if line and line[0] != '#':
break   # Leave it alone
else:
if symbol != "eval":
source = "pass" # Replace it with a 'pass' statement

As noted above, 'pass\n' is treated the same as '\n'

The first line above originally had a space, but IDLE appears to strip trailing 
whitespace also, even outside of comments.  (For an ending '\ ', this prevents 
SyntaxError, but maybe this is a bad lesson for beginners.)  However, I did 
find a case with an unnecessary continuation line.

>>>  # a
 
>>> 

This puzzles me, as it should be treated exactly the same as without the space 
after '#'.  ast.dump(ast.parse(' # a\n', '', 'single')) gives the same result, 
'Module(body=[], type_ignores=[])', as without.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue38675] Improve scope example in Tutorial, chapter 9

2019-11-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

To me, this is a plausible addition

--
nosy: +terry.reedy

___
Python tracker 

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



[issue38675] Improve scope example in Tutorial, chapter 9

2019-11-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: Sug. for the scope example in TPT Chapter 9 -> Improve scope example in 
Tutorial, chapter 9

___
Python tracker 

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



[issue38749] sqlite3 driver fails on four byte unicode strings coming from JSON_EXTRACT

2019-11-08 Thread mike bayer


mike bayer  added the comment:

silly me thinking python devs had better access to SQLite devs :)

--

___
Python tracker 

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



[issue38749] sqlite3 driver fails on four byte unicode strings coming from JSON_EXTRACT

2019-11-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It awaits moderator approval.

--

___
Python tracker 

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



[issue38749] sqlite3 driver fails on four byte unicode strings coming from JSON_EXTRACT

2019-11-08 Thread mike bayer


mike bayer  added the comment:

Hi where did you report it?I don't see it on the mailing list or in their 
fossil tracker.

--

___
Python tracker 

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



[issue38750] Solve IPv4 categorisation issues with the ipaddress module

2019-11-08 Thread Pete Wicken


Pete Wicken  added the comment:

In addition to my previous comment, I think a more generic "is_special" could 
cover everything in the IANA special purpose address table for ease of checking 
anything that isn't publicly available IP.

--

___
Python tracker 

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



[issue38749] sqlite3 driver fails on four byte unicode strings coming from JSON_EXTRACT

2019-11-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I have reported a bug to SQLite. Will see an answer.

It could be possible to implement a workaround in Python if this behavior will 
not be fixed.

--
nosy: +ghaering

___
Python tracker 

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



[issue27465] IDLE:Make help source menu entries unique and sorted.

2019-11-08 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
pull_requests: +16601
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/17093

___
Python tracker 

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



[issue38750] Solve IPv4 categorisation issues with the ipaddress module

2019-11-08 Thread Pete Wicken


Change by Pete Wicken :


--
components: +Library (Lib)
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



[issue38750] Solve IPv4 categorisation issues with the ipaddress module

2019-11-08 Thread Pete Wicken


New submission from Pete Wicken :

As alluded to in issue bpo-38655, the behaviour for getting categorising IPv4 
networks is inconsistent with the IANA guideline, which the docs say it follows.

I'm proposing we either change the documentation so that it describes the 
behaviour that should actually be expected, or we rewrite some parts of the 
ipaddress module so that they follow the guidelines.

For the latter, my thoughts would be to actually implement the check table on 
the IANA page 
(https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml).

i.e for a given address, you can ask of it "is_forwardable", 
"is_globally_reachable", etc.

--
messages: 356265
nosy: Wicken
priority: normal
severity: normal
status: open
title: Solve IPv4 categorisation issues with the ipaddress module

___
Python tracker 

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



[issue38723] Pdb._runscript should use io.open_code() instead of open()

2019-11-08 Thread Jason Killen


Jason Killen  added the comment:

I flipped through PEP 578 (Runtime Audit Hooks) and this seems like the type of 
situation that PEP 578 was trying to handle.  I've got a change that seems to 
be working and can provide a PR or whatever once I remember/read up on doing 
that.  (I'm a very seldom contributor and am more than happy to defer to those 
that know more than me.)

--
nosy: +Jason.Killen

___
Python tracker 

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



[issue38749] sqlite3 driver fails on four byte unicode strings coming from JSON_EXTRACT

2019-11-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Seems this is a bug in JSON_EXTRACT.

--

___
Python tracker 

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



[issue38749] sqlite3 driver fails on four byte unicode strings coming from JSON_EXTRACT

2019-11-08 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

sqlite> select JSON_EXTRACT('["t\u00e8\u015b\ud835\udd99"]', '$[0]');
tèś��

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue38672] mimetypes.init() fails if no access to one of known files

2019-11-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

An exception report is a failure to finish but not a crash as meant here.

The current code requires all known files and any file explicitly passes to be 
readable.  The proposed simple change would make it OK if none of them are.  
But is this really OK?

Is it really OK if known files are not readable?  Should they not be readable 
by all?

Removing the isfile call would allow directories to be passed through to 
db.readfp.  This might not be a good idea.  We would definitely have to think 
about what errors might be raised on different systems.

I think the try-except should be in init rather than db.read.  The latter can 
be called directly and I think a user explicitly passing an filename should be 
notified.  This comment actually also applies to files passed to init.

[Sidenote: the doc says that MimeTypes "provides an interface similar to the 
one of the mimetypes module."  The mimetypes.db used by mimetypes functions 
*is* a MimeTypes instance and the user can call db methods anything after 
init().]

Overall, I am not convinced that the current behavior is a bug, in which case 
this is an 'enhancement' request that changes the current API.  I am not at all 
a mimetypes expert, so I nosied a couple of email people who have worked on the 
module and should know more.

--
nosy: +maxking, r.david.murray, terry.reedy
title: Crash on mimetypes.init() if there is no access to one of knownfiles -> 
mimetypes.init() fails if no access to one of known files

___
Python tracker 

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



[issue32417] fromutc does not respect datetime subclasses

2019-11-08 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

This issue broke a date subclass in the calendra project 
(https://github.com/jaraco/calendra/issues/11). I acknowledge this change was a 
known breakage, but I mention it here and link the downstream issue for your 
information.

--
nosy: +jaraco

___
Python tracker 

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



[issue38669] patch.object should raise another error when first argument is a str

2019-11-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This enhancement request (no backports) is about the unittest.mock patch.object.
https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch.object

--
nosy: +terry.reedy
type:  -> enhancement
versions:  -Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue38744] python 3.8 hang in multiprocessing.Pool() locking on FreeBSD

2019-11-08 Thread Ned Deily


Change by Ned Deily :


--
nosy: +davin, pitrou

___
Python tracker 

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



[issue38749] sqlite3 driver fails on four byte unicode strings coming from JSON_EXTRACT

2019-11-08 Thread mike bayer

New submission from mike bayer :

When using unicode characters inside of JSON strings, values retrieved via the 
JSON_EXTRACT SQLite function fail to be decoded by the sqlite3 driver if they 
include four-byte unicode characters.

Version information for my build, which is Fedora 30:

Python 3.7.4 (default, Jul  9 2019, 16:32:37) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.version
'2.6.0'
>>> sqlite3.sqlite_version
'3.26.0'


Demo as follows:

import json
import sqlite3

# two unicode strings, the second one has four byte character in it
good_data = "réve illé"
bad_data = "réve illé"

# create simple json structures
good_data_json = json.dumps({"foo": good_data})
bad_data_json = json.dumps({"foo": bad_data})

# all strings are valid utf-8
# data round trips correctly through json
assert json.loads(good_data_json.encode("utf-8").decode("utf-8")) == {
"foo": good_data
}
assert json.loads(bad_data_json.encode("utf-8").decode("utf-8")) == {
"foo": bad_data
}


conn = sqlite3.connect(":memory:")
cursor = conn.cursor()

cursor.execute("CREATE TABLE some_data (id INT, data JSON)")
cursor.executemany(
"INSERT INTO some_data(id, data) VALUES(?, ?)",
[(1, good_data_json), (2, bad_data_json)],
)

# we can retrieve the JSON objects as a whole from the DB, no issue
cursor.execute("SELECT some_data.data FROM some_data ORDER BY id")
assert cursor.fetchall() == [(good_data_json, ), (bad_data_json, )]

# when we use JSON_EXTRACT, then full utf-8 support is lost

# extract good value from JSON object
cursor.execute("""
SELECT JSON_EXTRACT(some_data.data, '$."foo"')
FROM some_data WHERE id=1
""")
assert cursor.fetchone()[0] == good_data

# extract bad value from JSON object; utf-8 failure
# sqlite3.OperationalError: Could not decode to UTF-8 column
# 'JSON_EXTRACT(some_data.data, '$."foo"')' with text 'r��ve�� ill��'
cursor.execute("""
SELECT JSON_EXTRACT(some_data.data, '$."foo"')
FROM some_data WHERE id=2
""")
assert cursor.fetchone()[0] == bad_data


output:


Traceback (most recent call last):
  File "test4.py", line 50, in 
""")
sqlite3.OperationalError: Could not decode to UTF-8 column 
'JSON_EXTRACT(some_data.data, '$."foo"')' with text 'r��ve�� ill��'


surprising to say the least as the SQLite driver has always been completely 
solid with all unicode, but there you go.

--
components: Library (Lib)
messages: 356257
nosy: zzzeek
priority: normal
severity: normal
status: open
title: sqlite3 driver fails on four byte unicode strings coming from 
JSON_EXTRACT
type: crash
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



[issue38707] Multiprocessing: bug with Native ID for threading.mainthread()

2019-11-08 Thread Ned Deily


Change by Ned Deily :


--
nosy: +davin

___
Python tracker 

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



[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-08 Thread Fabio Zadrozny


Fabio Zadrozny  added the comment:

@Mark

I can think of many use-cases which may break if the function code is changed 
(users can change the code in real-use cases and when they do that they'd loose 
debugging).

So, as long as the function code is part of the public API of Python, the 
debugger can't really change it for breakpoints (which is a bit different from 
the frame code, which the user can't really swap and it's not so common to 
change).

--

___
Python tracker 

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



[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-08 Thread Mark Shannon


Mark Shannon  added the comment:

It sounds to me like `PyInterpreterState.eval_frame` is being used to lazily 
modify the bytecode to support breakpoints.

I can see no reason why changing the bytecode can't be done via 
`function.__code__`.
Suppose the code-object with the breakpoint add is `bcode`, then to turn on the 
breakpoint:
original_code = f.__code__
f.__code__ = bcode

and to turn it off
f.__code__ = original_code


The JVM supports bytecode instrumentation (via class loaders). It works well, 
as it provides a clear way for third party tools to modify the behaviour of a 
particular piece of code without violating any of the invariants of the 
interpreter. 
We don't really advertise setting `function.__code__` as a way to add 
low-impact breakpoints or profiling, but it is there.

If this use case is important, and it sounds like it is, then a better option 
would be to offer library support for adding and removing 
breakpoints/instrumentation.
This would have the advantage of being composable in a way that changing 
`PyInterpreterState.eval_frame` is not; in other words, it would be possible 
for one tool to add profiling and another to add breakpoints and have both work 
correctly.

I can write up a PEP if necessary.

--

___
Python tracker 

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



[issue38738] Fix formatting of True and False

2019-11-08 Thread Vedran Čačić

Vedran Čačić  added the comment:

Very nice. I aplaud your return to the original Python terminology, of true and 
false as adjectives, and True and False as names for specific objects. Perlisms 
such as `truthy` or `that evaluates as True` simply make my head spin.

I wrote one comment, regarding the case where you have the default value 
mentioned. Otherwise, I think it is a very nice change.

--
nosy: +veky

___
Python tracker 

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



[issue38747] Slowly introduce a subset of Jupyter console (IPython) features into CPython command line interactive mode

2019-11-08 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Interpreter Core -Demos and Tools
priority: normal -> low
type:  -> enhancement

___
Python tracker 

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



[issue38729] mock.create_autospec generates incorrect signature for some decorated methods

2019-11-08 Thread Ben Reilly


Ben Reilly  added the comment:

Yes, your description sounds right, and I had zero-ed in on the same park of 
the mock code when I was doing my investigation.

I know that this is a peculiar situation, but one thing to note is that 
`inspect.signature` gets the signature right on these wrapped methods. You can 
see this if you were to add in an appropriate spot the following code to the 
script:


from inspect import signature

print(signature(a.with_arg))  # prints `(x)`
print(signature(a.no_arg))# prints `()`


Is there a reason why mock calculates the signature on its own rather than 
relying on `inspect`?

--

___
Python tracker 

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



[issue38739] pyperformance html5lib cannot import Mapping (and fails)

2019-11-08 Thread Travis Lazar


Travis Lazar  added the comment:

Really appreciate all the commentary and references here. Thanks for that.

The resolution of disabling html5lib in pyperformance is good. I'll assume no 
html5lib benchmarking in pyperformance (master) until a version of html5lib is 
released compatible with 3.9.

Thanks again.

--

___
Python tracker 

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



[issue38743] configure: on macOS (darwin) add CoreFoundation to flags before checking for gettext

2019-11-08 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-08 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

I think you must still be experiencing some sort of sandboxing. I don't know 
how else you would get an EPERM out of pidfd_open.

--

___
Python tracker 

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



[issue38740] Line count mis match between open() vs sys.stdin api calls

2019-11-08 Thread Thamme Gowda


Thamme Gowda  added the comment:

Thanks for the quick response. 
Yes ``newline="\n"`` fixed it. 
So it as a known behavior. (I was tempted to consider it as a bug since the 
behavior differed from sys.stdin)

Thank you.

--

___
Python tracker 

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



[issue38748] 32 bit ctypes stdcall callback fails to restore stack pointer

2019-11-08 Thread David Heffernan


New submission from David Heffernan :

Starting with Python 3.8 certain ctypes callbacks fail to restore the stack 
pointer.

In the repo below, when the DLL is compiled with MSVC under default debug 
settings, running the Python script leads to a debug error dialog which says:


Run-Time Check Failure #0 - The value of ESP was not properly saved across a 
function call.  This is usually a result of calling a function declared with 
one calling convention with a function pointer declared with a different 
calling convention.


It appears that when the C code calls the callback function, the value of ESP 
is 4 greater than it should be.

This problem does not occur with older versions of Python.


**DLL code**

#include 

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID 
lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

typedef void (__stdcall *MYCALLBACK)(int, double);

extern "C"
{
__declspec(dllexport) void __stdcall foo(MYCALLBACK callback)
{
callback(1, 11);
callback(2, 21);
callback(3, 31);
}
}

**Python code**

import ctypes
import ctypes.wintypes

def CallbackType(restype, *argtypes):

def from_param(cls, obj):
if obj is None:
return obj
return ctypes._CFuncPtr.from_param(obj)

result = ctypes.WINFUNCTYPE(restype, *argtypes)
result.from_param = classmethod(from_param)
return result

MYCALLBACK = CallbackType(
None,
ctypes.c_int,
ctypes.c_double
)

def callback(handle, time):
print(handle, time)
mycallback = MYCALLBACK(callback)

lib = ctypes.WinDLL(r'path\to\dll\foo.dll')
func = getattr(lib, '_foo@4')
func.restype = None
func.argtypes = MYCALLBACK,
func(mycallback)

--
components: ctypes
messages: 356249
nosy: David Heffernan
priority: normal
severity: normal
status: open
title: 32 bit ctypes stdcall callback fails to restore stack pointer
type: crash
versions: Python 3.8

___
Python tracker 

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



[issue38747] Slowly introduce a subset of Jupyter console (IPython) features into CPython command line interactive mode

2019-11-08 Thread Marco Sulla

New submission from Marco Sulla :

Sometimes I’m lazy and I would test code copy - pasted from internet or from 
other sources directly in the interpreter, in interactive mode. But if the code 
contains completely blank lines, the copy - paste fails. For example:

def f():
print("Marco")

print("Sulla")

does not work, but

def f():
print("Marco")

print("Sulla")

yes. Notice that in a script the first code block is perfectly valid and works.

This does not happen with Jupiter console, aka IPython. Jupiter implements 
bracketed paste mode, so it distinguish between normal input and pasted input.

Jupyter offers also:
- autoindent
- save code blocks in one history entry: this way, if you write a function, for 
example, and you press the up key, the whole function will be loaded, and not 
its last line.
- auto-reloading of modules. It should be disabled by default and enabled by a 
flag, and could auto-reload a module if its code changes.
- save code to console. All the code written in the current interactive session 
could be saved to the clipboard. It could be triggered by F12.
- history: it could be a new built-in function. if called without parameters, 
it could show the history, with lines numbered. If called with a number, it 
will paste the corresponding history line to the console
- pretty printing and source inspection. IMHO pprint.pprint() and 
inspect.getsource() are so useful in interactive mode that could be added to 
builtins.
- syntax coloring. It should be disabled by default, and could be enabled by a 
flag or a config.
- bracket matching. See above.

I think that implementing all of this in CPython is really hard. I suppose that 
maybe many things are not possible for compatibility between platforms, or 
can't be available everywhere, like syntax coloring.

--
components: Demos and Tools
messages: 356248
nosy: Marco Sulla
priority: normal
severity: normal
status: open
title: Slowly introduce a subset of Jupyter console (IPython) features into 
CPython command line interactive mode
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



[issue38743] configure: on macOS (darwin) add CoreFoundation to flags before checking for gettext

2019-11-08 Thread Ned Deily


Change by Ned Deily :


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



[issue38736] argparse: wrong type from get_default when type is set

2019-11-08 Thread paul j3


paul j3  added the comment:

Yes you can set the default to be any object, such as an evaluated string.  If 
it isn't a string it won't be passed through 'type'.

The purpose of the delayed evaluation that I described is to avoid unnecessary 
evaluations.  The worse case would be a write filetype.  You don't want to 
create (or over write) a default file if it never gets used.

(I intend to close this issue).

--

___
Python tracker 

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



[issue38746] HTML5 named character references not consistent

2019-11-08 Thread Mike Raider


New submission from Mike Raider :

In the file 
cpython/blob/master/Lib/html/entities.py

the HTML5 named character references (line 264) do not look consistent.

Some references have a semicolon at the end, some not, and some have both 
variants.

Is there a reason for this?

--
components: Library (Lib)
messages: 356246
nosy: mikeraider
priority: normal
severity: normal
status: open
title: HTML5 named character references not consistent

___
Python tracker 

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



[issue38745] pygame install error using python 3.8.0

2019-11-08 Thread Christian Heimes


Christian Heimes  added the comment:

pygame is a third-party component and not developed by the Python core team. 
This bug tracker is only for issues with Python itself. Please report the 
problem with pygame.

--
nosy: +christian.heimes
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



[issue38745] pygame install error using python 3.8.0

2019-11-08 Thread Suresh Murugesan


New submission from Suresh Murugesan :

I tried to install pygame, using pip install pygame, on my windows 10 running 
python 3.8.0. But it fails with the following error messages

Can you please help. I read on the internet that 3.8 is not stable yet for 
pygame. Is it true?

   ERROR: Command errored out with exit status 1:
 command: 
'c:\users\smuru02\appdata\local\programs\python\python38-32\python.exe' -c 
'import sys, setuptools, tokenize; sys.argv[0] = 
'"'"'C:\\Users\\smuru02\\AppData\\Local\\Temp\\pip-install-0yqtpy1n\\pygame\\setup.py'"'"';
 
__file__='"'"'C:\\Users\\smuru02\\AppData\\Local\\Temp\\pip-install-0yqtpy1n\\pygame\\setup.py'"'"';f=getattr(tokenize,
 '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info 
--egg-base 
'C:\Users\smuru02\AppData\Local\Temp\pip-install-0yqtpy1n\pygame\pip-egg-info'
 cwd: C:\Users\smuru02\AppData\Local\Temp\pip-install-0yqtpy1n\pygame\
Complete output (17 lines):


WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...


Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x86"? 
[Y/n]Traceback (most recent call last):
  File "", line 1, in 
  File 
"C:\Users\smuru02\AppData\Local\Temp\pip-install-0yqtpy1n\pygame\setup.py", 
line 194, in 
buildconfig.config.main(AUTO_CONFIG)
  File 
"C:\Users\smuru02\AppData\Local\Temp\pip-install-0yqtpy1n\pygame\buildconfig\config.py",
 line 210, in main
deps = CFG.main(**kwds)
  File 
"C:\Users\smuru02\AppData\Local\Temp\pip-install-0yqtpy1n\pygame\buildconfig\config_win.py",
 line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
  File 
"C:\Users\smuru02\AppData\Local\Temp\pip-install-0yqtpy1n\pygame\buildconfig\download_win_prebuilt.py",
 line 302, in ask
reply = raw_input(
EOFError: EOF when reading a line

ERROR: Command errored out with exit status 1: python setup.py egg_info Check 
the logs for full command output.

--
components: Windows
messages: 356244
nosy: paul.moore, pysuresh, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: pygame install error using python 3.8.0
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



[issue38744] python 3.8 hang in multiprocessing.Pool() locking on FreeBSD

2019-11-08 Thread Dmitry Marakasov


New submission from Dmitry Marakasov :

System: FreeBSD 12.0-RELEASE, amd64.

This simple program

from multiprocessing import Pool
from time import sleep

Pool().map(sleep, [0.01] * 10)

works fine with python 3.7, but is likely (about 20-50% probability on my 4 
core box) to hang with python 3.8. Example backtraces after interruption:

% python3.8 1.py
^CException ignored in: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/multiprocessing/util.py", line 201, in __call__
Process ForkPoolWorker-2:
Process ForkPoolWorker-4:
res = self._callback(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 689, in 
_terminate_pool
cls._help_stuff_finish(inqueue, task_handler, len(pool))
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 674, in 
_help_stuff_finish
inqueue._rlock.acquire()
KeyboardInterrupt: 
Process ForkPoolWorker-3:
Process ForkPoolWorker-1:

% python3.8 1.py
^CException ignored in: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/multiprocessing/util.py", line 201, in __call__
Process ForkPoolWorker-3:
Process ForkPoolWorker-4:
Process ForkPoolWorker-1:
res = self._callback(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 689, in 
_terminate_pool
cls._help_stuff_finish(inqueue, task_handler, len(pool))
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 674, in 
_help_stuff_finish
inqueue._rlock.acquire()
KeyboardInterrupt: 
Process ForkPoolWorker-2:

% python3.8 1.py
^CException ignored in: 
Process ForkPoolWorker-2:
Process ForkPoolWorker-3:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/multiprocessing/util.py", line 201, in __call__
Process ForkPoolWorker-1:
res = self._callback(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 689, in 
_terminate_pool
cls._help_stuff_finish(inqueue, task_handler, len(pool))
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 674, in 
_help_stuff_finish
Traceback (most recent call last):
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 313, in 
_bootstrap
self.run()
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 313, in 
_bootstrap
self.run()
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 114, in worker
task = get()
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 114, in worker
task = get()
  File "/usr/local/lib/python3.8/multiprocessing/queues.py", line 355, in get
with self._rlock:
  File "/usr/local/lib/python3.8/multiprocessing/queues.py", line 355, in get
with self._rlock:
  File "/usr/local/lib/python3.8/multiprocessing/synchronize.py", line 95, in 
__enter__
return self._semlock.__enter__()
  File "/usr/local/lib/python3.8/multiprocessing/synchronize.py", line 95, in 
__enter__
return self._semlock.__enter__()
KeyboardInterrupt
KeyboardInterrupt
inqueue._rlock.acquire()
KeyboardInterrupt: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 313, in 
_bootstrap
self.run()
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 114, in worker
task = get()
  File "/usr/local/lib/python3.8/multiprocessing/queues.py", line 356, in get
res = self._reader.recv_bytes()
  File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 216, in 
recv_bytes
buf = self._recv_bytes(maxlength)
  File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 414, in 
_recv_bytes
buf = self._recv(4)
  File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 379, in 
_recv
chunk = read(handle, remaining)
KeyboardInterrupt
Process ForkPoolWorker-4:

Related issue in FreeBSD bugzilla: 
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241801

--
components: Library (Lib)
messages: 356243
nosy: AMDmi3
priority: normal
severity: normal
status: open
title: python 3.8 hang in multiprocessing.Pool() locking on FreeBSD
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



[issue32309] Implement asyncio.run_in_executor shortcut

2019-11-08 Thread Yury Selivanov


Yury Selivanov  added the comment:

> I think that I'm still not understanding something important though. Even if 
> we initialize our ThreadPoolExecutor outside of __init__ (in a start() 
> coroutine method, as your proposing), it seems like the threads will be 
> spawned throughout the lifespan of the threadpool, rather than upon startup 
> since the new threads are spawned in ThreadPoolExecutor *after* 
> executor.submit() is called (up to max_workers) rather than upon 
> initialization.

Correct.

> So even if an instance of ThreadPoolExecututor is initialized asynchronously 
> within a start() coroutine method, the individual threads within it won't be 
> spawned at the same time.

Correct.  There are a few points of this approach:

(a) design the API correctly; 
(b) ship something that definitely works with a proven ThreadPoolExecutor; 
(c) write lots of tests;
(d) write docs;
(e) if (a-d) are OK, refine the implementation later by replacing 
ThreadPoolExecutor with a proper (eager threads creation) implementation.

> That's why I wrote an explicit way of spawning threads in the above example, 
> based on the way that ThreadPoolExecutor spawns threads in 
> _adjust_thread_count(), which is called at the end of submit().

Yeah. In your current approach you're using ThreadPoolExecutor private API, 
which makes the code a bit fragile.  There are two alternatives:

1. Extent ThreadPoolExecutor API to add an option of eager threads spawn.

2. Not using ThreadPoolExecutor at all. We can write our own threads 
orchestration code, it's not that complicated. If we do that, our 
implementation will become quite faster than the current run_in_executor.  We 
can use curio as inspiration.  Last time I profiled asyncio I saw that the code 
binding concurrent.Future to asyncio.Future is quite complex, brittle, and slow.

I'm in favor of (2), but let's go through (a-d) steps to get there.

--

___
Python tracker 

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



[issue37784] Compiling Python 3 with sqlite impossible when sqlite installation is in a non standard directory

2019-11-08 Thread Emmanuel C


Emmanuel C  added the comment:

Sorry guy,

I've found my error : I have to use the CPPFLAGS instead of the CFLAGS in order 
to include sqlite3 into my own Python compiled installation.

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



[issue36852] Python3.7.2 fails to cross-compile (yocto / openembedded) when target is mips softfloat

2019-11-08 Thread Matthias Klose


Matthias Klose  added the comment:

I'll get back on this

--

___
Python tracker 

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



[issue36852] Python3.7.2 fails to cross-compile (yocto / openembedded) when target is mips softfloat

2019-11-08 Thread Matthias Schoepfer


Matthias Schoepfer  added the comment:

Hi!

I submitted this patch, it even is now on yocto zeus. Any progress, will 
someone review it?! 

Thanks and Regards,

Matthias

--

___
Python tracker 

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



[issue38743] configure: on macOS (darwin) add CoreFoundation to flags before checking for gettext

2019-11-08 Thread Jakub Piotr Cłapa

Change by Jakub Piotr Cłapa :


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

___
Python tracker 

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



[issue38743] configure: on macOS (darwin) add CoreFoundation to flags before checking for gettext

2019-11-08 Thread Jakub Piotr Cłapa

New submission from Jakub Piotr Cłapa :

macOS needs to link to CoreFoundation for gettext to work. We reorder the 
autoconf tests so CoreFoundation is added to LIBS earlier and the -lintl test 
does not fail (which would exclude it from the final set of flags).

Btw. the whole test seems fishy: if compilation fails it does not mean -lintl 
is not needed, for this we would need to test a gettext function without 
-lintl. Basically two tests (with and without -lintl) are needed to properly 
diagnose the situation. The test in question had been written in 2009 as a fix 
for the https://bugs.python.org/issue6154 bug report.

This may be an issue only with non-Framework builds (since Homebrew manages to 
build a framework-based Python on macOS without any special shenigans) but I 
had not tested it.

--
components: Build
messages: 356237
nosy: Jakub Piotr Cłapa
priority: normal
severity: normal
status: open
title: configure: on macOS (darwin) add CoreFoundation to flags before checking 
for gettext
type: compile error
versions: Python 3.9

___
Python tracker 

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



[issue38736] argparse: wrong type from get_default when type is set

2019-11-08 Thread Erik Ahlén

Erik Ahlén  added the comment:

So, not a bug since you can just do `default = Path('file.txt')`?

--

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-08 Thread Chih-Hsuan Yen


Chih-Hsuan Yen  added the comment:

I got a failure in newly added test_pidfd_open:

==
FAIL: test_pidfd_open (test.test_posix.PosixTester)
--
Traceback (most recent call last):
  File "/build/python-git/src/cpython/Lib/test/test_posix.py", line 1479, in 
test_pidfd_open
self.assertEqual(cm.exception.errno, errno.EINVAL)
AssertionError: 1 != 22

--

I'm running kernel 5.3.7-x86_64-linode130 with Arch Linux. At first I suspect 
that it's related to system call filters from systemd as tests are run in a 
systemd-nspawn container. However, there are still failures after patching 
systemd with 
https://github.com/systemd/systemd/commit/9e486265716963439fb0fd7f2a97abf109f24f75.

How about also skipping the test if pidfd_open returns EPERM?

--
nosy: +yan12125

___
Python tracker 

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



[issue38644] Pass explicitly tstate to function calls

2019-11-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16598
pull_request: https://github.com/python/cpython/pull/17089

___
Python tracker 

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



[issue38644] Pass explicitly tstate to function calls

2019-11-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7e433733175e76627d46ed9bdab543860cd1452d by Victor Stinner in 
branch 'master':
bpo-38644: Add _PyObject_VectorcallTstate() (GH-17052)
https://github.com/python/cpython/commit/7e433733175e76627d46ed9bdab543860cd1452d


--

___
Python tracker 

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



[issue38740] Line count mis match between open() vs sys.stdin api calls

2019-11-08 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This seems to be the difference between Universal Newlines or not. In Python 2, 
you have to set it explicitly with a U in the open mode:

$ python2.7 -c 'import sys; print("Linecount=", sum(1 for x in 
open(sys.argv[1], "Ur")))' line_break_err.txt
('Linecount=', 18)

In Python 3, Universal Newlines is the default for text files, but you can 
control it with the ``newline`` parameter:

$ python3.5 -c 'import sys; print("Linecount=", sum(1 for x in 
open(sys.argv[1], newline="\n")))' line_break_err.txt
Linecount= 9


$ python3.5 -c 'import sys; print("Linecount=", sum(1 for x in 
open(sys.argv[1], newline="\r")))' line_break_err.txt
Linecount= 15


I think this explains the difference you are seeing. Do you agree?

--
nosy: +steven.daprano

___
Python tracker 

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



[issue38276] test_asyncio: test_cancel_make_subprocess_transport_exec() failed on RHEL7 LTO + PGO 3.x

2019-11-08 Thread STINNER Victor


STINNER Victor  added the comment:

Timeout on the Ubuntu job of Azure Pipelines:

https://dev.azure.com/Python/cpython/_build/results?buildId=53629=logs=256d7e09-002a-52d7-8661-29ee3960640e

0:27:55 load avg: 0.11 [419/419/2] test_asyncio crashed (Exit code 1)
Timeout (0:20:00)!
Thread 0x7fe2c4fdf700 (most recent call first):
  File "/home/vsts/work/1/s/Lib/selectors.py", line 468 in select
  File "/home/vsts/work/1/s/Lib/asyncio/base_events.py", line 1837 in _run_once
  File "/home/vsts/work/1/s/Lib/asyncio/base_events.py", line 589 in run_forever
  File "/home/vsts/work/1/s/Lib/asyncio/base_events.py", line 621 in 
run_until_complete
  File "/home/vsts/work/1/s/Lib/test/test_asyncio/test_subprocess.py", line 440 
in test_cancel_make_subprocess_transport_exec
  File "/home/vsts/work/1/s/Lib/unittest/case.py", line 616 in _callTestMethod

--

___
Python tracker 

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



[issue38740] Line count mis match between open() vs sys.stdin api calls

2019-11-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Try to add newline="\n" in open().

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue16575] ctypes: unions as arguments

2019-11-08 Thread STINNER Victor


STINNER Victor  added the comment:

3.7 refleaks buildbots pass again (ignoring a few warnings).

--
resolution:  -> fixed

___
Python tracker 

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



[issue38742] ElementTree won't parse comments before root element

2019-11-08 Thread yucheng chen


New submission from yucheng chen :

issue8277
It couldn't work for those comments before the root element. 
It will raise an error that "xml.etree.ElementTree.ParseError: multiple 
elements on top level". 

Example:

test.xml




  
  
  


test.py
---
from xml.etree import ElementTree
class MyTreeBuilder(ElementTree.TreeBuilder):
   def comment(self, data):
   self.start(ElementTree.Comment, {})
   self.data(data)
   self.end(ElementTree.Comment)
with open('c:/temp/t.xml', 'r') as f:
   xml = ElementTree.parse(
   f, parser=ElementTree.XMLParser(target=MyTreeBuilder()))
ElementTree.dump(xml)

--
components: XML
messages: 356229
nosy: amaury.forgeotdarc, effbot, flox, poke, scoder, yucheng chen
priority: normal
severity: normal
status: open
title: ElementTree won't parse comments before root element
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue38739] pyperformance html5lib cannot import Mapping (and fails)

2019-11-08 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue38739] pyperformance html5lib cannot import Mapping (and fails)

2019-11-08 Thread STINNER Victor


STINNER Victor  added the comment:

I fixed the issue by disabling temporarily the benchmark, until html5lib is 
fixed:
https://github.com/python/pyperformance/commit/8043c159215836fa733ee0815feecdd359e8852a

--

That's Python bug tracker. The pyperformance bug tracker is at:
https://github.com/python/pyperformance/issues

Your issue is that "import html5lib" fails on Python 3.9 because there is no 
html5lib release including the fix:
https://github.com/html5lib/html5lib-python/issues/419

The bug has already been fixed in html5lib.

One workaround would be to disable htmllib benchmark on Python 3.9 until 
https://github.com/html5lib/html5lib-python/issues/419 is fixed.

--

> collections removed ABC access in 3.9.

That's bpo-25988 with commit ef092fe9905f61ca27889092ca1248a11aa74498.

--

pip backported the html5lib patch:
https://github.com/pypa/pip/commit/ef7ca1472c1fdd085cffb8183b7ce8abbe9e2800#diff-2496ad1eedee846e323ed2916d6c2d24

The fix is included in pip since pip 19.3.1.

Note: The ensurepip module of the master branch of Python uses a bundled copy 
of pip 19.2.3.

--
nosy: +vstinner

___
Python tracker 

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