[issue32129] Icon on macOS

2017-11-24 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Here is the current code in idlelib.pyshell.main.

# set application icon
icondir = os.path.join(os.path.dirname(__file__), 'Icons')
if system() == 'Windows':
iconfile = os.path.join(icondir, 'idle.ico')
root.wm_iconbitmap(default=iconfile)
else:
ext = '.png' if TkVersion >= 8.6 else '.gif'
iconfiles = [os.path.join(icondir, 'idle_%d%s' % (size, ext))
 for size in (16, 32, 48)]
icons = [PhotoImage(master=root, file=iconfile)
 for iconfile in iconfiles]
root.wm_iconphoto(True, *icons)

IDLE uses wm_iconbitmap on Windows and wm_iconphoto with PhotoImages from .gif 
or .png on everything else.  It appears that wm_iconphoto is already used on 
macOS with tk 8.5.

The uploaded PM.png looks like it might be idle16.png zoomed out at least 3x.  
Anything that does that instead of using the much sharper 32 or 48 bit versions 
is, to me, buggy.  The bigger images stay much sharper even when zoomed.

--
nosy: +ned.deily

___
Python tracker 

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



[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Thank you Cristian for reporting this issue. Thank you Mandeep for your patch. 
Thank you Mariatta for merging.

--

___
Python tracker 

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



[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-24 Thread Nick Coghlan

Nick Coghlan  added the comment:

+1 from me for using "default" instead of "always" for ResourceWarning.

Folks can always combine "-X tracemalloc" with "-W always::ResourceWarning" if 
want to ensure they see absolutely every resource warning, rather than only 
representative ones.

--

___
Python tracker 

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



[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

Thanks everyone. I merged the PR, and it's been backported to 3.6 and 2.7

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

___
Python tracker 

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



[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset 3e60747025edc34b503397ab8211be59cfdd05cd by Mariatta (Miss 
Islington (bot)) in branch '3.6':
bpo-30004: Fix the code example of using group in Regex Howto Docs (GH-4443) 
(GH-4554)
https://github.com/python/cpython/commit/3e60747025edc34b503397ab8211be59cfdd05cd


--

___
Python tracker 

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



[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset c02037d62284f4d4ca6b22f2ed05165ce2014951 by Mariatta (Miss 
Islington (bot)) in branch '2.7':
bpo-30004: Fix the code example of using group in Regex Howto Docs (GH-4443) 
(GH-4555)
https://github.com/python/cpython/commit/c02037d62284f4d4ca6b22f2ed05165ce2014951


--

___
Python tracker 

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



[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4486

___
Python tracker 

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



[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4485

___
Python tracker 

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



[issue30004] in regex-howto, improve example on grouping

2017-11-24 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset 610e5afdcbe3eca906ef32f4e0364e20e1b1ad23 by Mariatta (Mandeep 
Bhutani) in branch 'master':
bpo-30004: Fix the code example of using group in Regex Howto Docs (GH-4443)
https://github.com/python/cpython/commit/610e5afdcbe3eca906ef32f4e0364e20e1b1ad23


--
nosy: +Mariatta

___
Python tracker 

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



[issue32129] Icon on macOS

2017-11-24 Thread Kevin Walzer

New submission from Kevin Walzer :

The trunk and 8.6.7 branch of Tk on macOS have recently implemented the 
wm_iconphoto command, which had not previously been supported on macOS. This 
means that versions of IDLE that link to this version of Tk will inherit the 
iconphoto behavior on Windows and X11, which results in a extremely blurry icon 
image in the Dock. It would probably be best to make this command conditional 
on macOS to just retain the standard app icon, or else add a sharper image.

--
assignee: terry.reedy
components: IDLE
files: Screen Shot 2017-11-24 at 11.44.31 PM.png
messages: 306941
nosy: terry.reedy, wordtech
priority: normal
severity: normal
status: open
title: Icon on macOS
type: behavior
Added file: https://bugs.python.org/file47288/Screen Shot 2017-11-24 at 
11.44.31 PM.png

___
Python tracker 

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



[issue10544] yield expression inside generator expression does nothing

2017-11-24 Thread Nick Coghlan

Nick Coghlan  added the comment:

I realised that even without modifying the compiler first, I could illustrate 
the proposed `yield from` based resolution for the comprehension case by way of 
explicit yield from clauses:

```
def get_gen_result(gen, inputs):
try:
yield_value = next(gen)
for send_value in inputs:
print(f"Received: {yield_value}; Sending: {send_value}")
yield_value = gen.send(send_value)
except StopIteration as exc:
return exc.value
raise RuntimeError("Failed to exhaust generator")

def example():
comp1 = yield from [str((yield x)) for x in ('1st', '2nd')]
comp2 = yield from [int((yield x)) for x in ('3rd', '4th')]
return comp1, comp2

>>> result = get_gen_result(example(), range(4))
Received: 1st; Sending: 0
Received: 2nd; Sending: 1
Received: 3rd; Sending: 2
Received: 4th; Sending: 3
>>> result
(['0', '1'], [2, 3])
```

So if we decided to make yield-in-a-comprehension imply the use of yield from, 
we'd only need:

- DeprecationWarning in 3.7 to say "this is going to imply 'yield from 
(comprehension)' in 3.8+"
- making the 'yield from' implicit in 3.8 (thus ensuring that comprehensions 
always return the correct container type, even when they include yield 
expressions)

--

___
Python tracker 

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



[issue10544] yield expression inside generator expression does nothing

2017-11-24 Thread Nick Coghlan

Nick Coghlan  added the comment:

Given the direction of the python-dev thread, should we split this question 
into two issues?

Issue 1: a yield expression inside a comprehension changes the type of the 
expression result (returning a generator-iterator instead of the expected 
container type)

Issue 2: a yield expression inside a generator expression interacts weirdly 
with the genexp's implicit yield expression

I ask, as it seems to me that issue 1 can be addressed by wrapping the affected 
cases in an implicit 'yield from' expression, which will both fix the return 
type of the expression and turn the outer function into a generator (if it 
isn't one already). (I'm going to put together a proof-of-concept for that idea 
this weekend)

By contrast, the interaction between generator expressions and explicit yield 
expressions seems intrinsically confusing, so I'm not sure we can do any better 
than declaring it a syntax error to try to combine them.

--

___
Python tracker 

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



[issue32096] Py_DecodeLocale() fails if used before the runtime is initialized.

2017-11-24 Thread Nick Coghlan

Nick Coghlan  added the comment:

Huh, those crashes are interesting - I'd guess that it means we have a 
platform-dependent dependency from Py_DecodeLocale on to Py_SetPythonHome in 
order to locate the encodings module. If I'm right, that dependency would then 
mean that embedding applications can only rely on Py_DecodeLocale to do "char 
*" to "wchar_t *" conversions if they can also rely on the locale encoding 
always being a builtin one that bypasses the search for the encodings module.

Perhaps we should be recommending temporarily doing 'setenv("PYTHONHOME", 
home)' (and then reverting that after calling Py_Initialize so it doesn't get 
inherited by subprocesses) as the preferred approach to handling platforms with 
"char *" based native filesystem APIs, and adding such a setting to that 
particular `_testembed` test?

--

___
Python tracker 

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



[issue32124] Document functions safe to be called before Py_Initialize()

2017-11-24 Thread Nick Coghlan

Nick Coghlan  added the comment:

Key point to note regarding PEP 432: at least personally, I'm not actually 
aiming to deprecate the legacy embedding API.

Instead, I'm just aiming to eventually stop *adding* to it, with new config 
structs replacing the current ad hoc mix of pre-init function calls, C globals, 
environment variables, and filesystem state.

That means I'm quite willing to accept maintaining compatibility for 
applications using the current single phase initialisation approach as a design 
constraint for the PEP.

We have a similar constraint in place for extension modules: 
even though any *new* features we introduce are likely to be dependent on 
switching over to PEP 489's multi-phase initialisation APIs, we still ensure 
that single-phase initialisation continues working for existing modules.

--

___
Python tracker 

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



[issue19613] test_nntplib: sporadic failures, test_article_head_body()

2017-11-24 Thread Martin Panter

Martin Panter  added the comment:

Victor opened Issue 32128 with the same complaint. I think I found the 
offending article:

>>> server = NNTP_SSL("nntp.aioe.org")
>>> [response, count, first, last, name] = server.group("comp.lang.python")
>>> last
199267
>>> pprint(server.article(199265)[1].lines)
[. . .
 b'Date: Fri, 24 Nov 2017 15:44:26 -0800 (PST)',
 . . .
 b'Message-ID: ',
 b'Subject: Re: Python loop and web server (bottle) in the same script 
(Posting',
 b' On Python-List Prohibited)',
 . . .
 b'Content-Transfer-Encoding: quoted-printable',
 . . .
 b'If processing is I/O bound and not CPU bound, then asyncio should work 
fine=',
 b'.']

The body uses Quoted-printable encoding, and the previous line ends with an 
equals sign “=”, meaning a soft line break. So the full stop is on its own 
because the encoder didn’t want to fit it on the previous line. This is valid 
(albeit quirky) encoding, and not a problem with the NNTP library.

--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 9316ee4da2dcc217351418fc4dbe9205995689e0 by Victor Stinner in 
branch 'master':
bpo-32030: Add _PyPathConfig_Init() (#4551)
https://github.com/python/cpython/commit/9316ee4da2dcc217351418fc4dbe9205995689e0


--

___
Python tracker 

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



[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x

2017-11-24 Thread Martin Panter

Martin Panter  added the comment:

If it helps, here is a basic test case I wrote for “pty.spawn”. I hope that it 
exposes the problem on Free BSD, but I have only tested it on Linux.

parent = r'''\
import pty, sys
pty.spawn((sys.executable, "-c", sys.argv[1]))
'''
child = r'''\
import sys
# Read input first of all to minimize output buffering
input = sys.stdin.readline()
print("isatty: {}, {}, {}".format(
sys.stdin.isatty(), sys.stdout.isatty(), sys.stderr.isatty()))
print("input: " + repr(input))
sys.stdout.write("stdout data\n")
sys.stderr.write("stderr data\n")
'''
args = (sys.executable, "-c", parent, child)
parent = subprocess.Popen(args,
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
try:
parent.stdin.write(b"stdin data\n")
parent.stdin.flush()
# Leave input open. When the child closes the slave terminal on
# Free BSD, “spawn” used to keep waiting for input (BPO 26228).
output = parent.stdout.read()
finally:
parent.stdout.close()
parent.stdin.close()
parent.wait()
self.assertEqual(0, parent.returncode, repr(output))
self.assertIn(b"isatty: True, True, True", output)
self.assertIn(br"input: 'stdin data\n'", output)
self.assertIn(b"stdout data", output)
self.assertIn(b"stderr data", output)

--

___
Python tracker 

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



[issue32128] test_nntplib: test_article_head_body() fails in SSL mode

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset dde38b9cb3ff24f2f1f17cb681d30741e0090f51 by Victor Stinner (Miss 
Islington (bot)) in branch '3.6':
bpo-32128: Skip test_nntplib.test_article_head_body() (GH-4552) (#4553)
https://github.com/python/cpython/commit/dde38b9cb3ff24f2f1f17cb681d30741e0090f51


--

___
Python tracker 

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



[issue32127] tutorial on dictionaries has error in example

2017-11-24 Thread Eric V. Smith

Eric V. Smith  added the comment:

No problem. Welcome to Python!

--

___
Python tracker 

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



[issue32128] test_nntplib: test_article_head_body() fails in SSL mode

2017-11-24 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4484

___
Python tracker 

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



[issue32128] test_nntplib: test_article_head_body() fails in SSL mode

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 706cb3162e15271ecfeba15909ed48a3a437009f by Victor Stinner in 
branch 'master':
bpo-32128: Skip test_nntplib.test_article_head_body() (#4552)
https://github.com/python/cpython/commit/706cb3162e15271ecfeba15909ed48a3a437009f


--

___
Python tracker 

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



[issue32128] test_nntplib: test_article_head_body() fails in SSL mode

2017-11-24 Thread STINNER Victor

Change by STINNER Victor :


--
keywords: +patch
pull_requests: +4483
stage:  -> patch review

___
Python tracker 

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



[issue32128] test_nntplib: test_article_head_body() fails in SSL mode

2017-11-24 Thread STINNER Victor

New submission from STINNER Victor :

The news.trigofacile.com NNTP server used by test_nntplib currently has 
troubles on SSL:

$ ./python -m test -u all -v test_nntplib -m test_article_head_body  

==
FAIL: test_article_head_body (test.test_nntplib.NetworkedNNTP_SSLTests)
--
Traceback (most recent call last):
  File "/home/haypo/prog/python/3.6/Lib/test/test_nntplib.py", line 242, in 
wrapped
meth(self)
  File "/home/haypo/prog/python/3.6/Lib/test/test_nntplib.py", line 187, in 
test_article_head_body
self.check_article_resp(resp, body, art_num)
  File "/home/haypo/prog/python/3.6/Lib/test/test_nntplib.py", line 167, in 
check_article_resp
self.assertNotIn(article.lines[-1], (b".", b".\n", b".\r\n"))
AssertionError: b'.' unexpectedly found in (b'.', b'.\n', b'.\r\n')


See also bpo-19613.

--
components: Tests
messages: 306930
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_nntplib: test_article_head_body() fails in SSL mode
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-11-24 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4482

___
Python tracker 

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



[issue30855] [2.7] test_tk: test_use() of test_tkinter.test_widgets randomly fails with "integer value too large to represent" on with AMD64 Windows8 3.5

2017-11-24 Thread Zachary Ware

Change by Zachary Ware :


--
pull_requests: +4481
stage: resolved -> patch review

___
Python tracker 

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



[issue29885] Allow GMT timezones to be used in datetime.

2017-11-24 Thread Decorater

Change by Decorater :


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



[issue30396] Document the PyClassMethod* C API functions.

2017-11-24 Thread Decorater

Change by Decorater :


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



[issue32030] PEP 432: Rewrite Py_Main()

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset f04ebe2a4d68b194deeb438e9185efdafc10a832 by Victor Stinner in 
branch 'master':
bpo-32030: Add _PyMainInterpreterConfig.program_name (#4548)
https://github.com/python/cpython/commit/f04ebe2a4d68b194deeb438e9185efdafc10a832


--

___
Python tracker 

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



[issue32118] Docs: add note about sequence comparisons containing non-orderable elements

2017-11-24 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

This whole section has become a mess an is now more complex that the underlying 
code.   Adding more caveats, special cases, and atypical examples will make it 
worse (rather like the U.S. tax code, another example of bad technical writing).

I recommend the whole section be rewritten, extracting the most general rules 
and with examples that cover the general rules.

There can then be brief separate paragraphs for language lawyers that cover 
what makes NaNs and None unusual (none of the comparison logic special cases 
these value -- their interesting behaviors are intrinsic to the object itself).

--
nosy: +rhettinger

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-11-24 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4480

___
Python tracker 

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



[issue32116] CSV import and export simplified

2017-11-24 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I'm also -1 on this feature request.  The open and closing of files is 
orthogonal to what you do with an open file.  Likewise, iterators are 
orthogonal to how they are consumed (for-loops, list(), set(), etc).

FWIW, csv.Reader object is an iterator that can be fed directly to list():

result = list(csv.reader(fileobj)

--
nosy: +rhettinger
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue32124] Document functions safe to be called before Py_Initialize()

2017-11-24 Thread Eric Snow

Eric Snow  added the comment:

I've left a review (writing it as you merged the PR).

My main concern is that we not promise more than we must.  Every pre-init 
function or variable we promise to embedders represents global state that is 
hard to get rid of.  It also entrenches pre-init API and state that we're 
aiming to deprecate (via PEP 432).

--

___
Python tracker 

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



[issue32123] Make the API of argparse.HelpFormatter public

2017-11-24 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I suggest that you open a thread on python-ideas list: something like 'Make 
argparse.HelpFormatter public'.  Explain what you would like to have happen and 
why.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 46972b7bc385ec2bdc7f567bbd22c9e56ffdf003 by Victor Stinner in 
branch 'master':
bpo-32030: Add _PyMainInterpreterConfig_ReadEnv() (#4542)
https://github.com/python/cpython/commit/46972b7bc385ec2bdc7f567bbd22c9e56ffdf003


--

___
Python tracker 

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



[issue27535] Ignored ResourceWarning warnings leak memory in warnings registries

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:

> These results look strange to me. I expected the same difference but smaller 
> the base time.

Honestly, I was also surprised.

I checked the whole benchmark twice. I also rebased the PR locally to make sure 
that it's not a side effect of a recent change in master.

Results are reliable and reproductible.

FYI I ran the C benchmark on my laptop "apu" using CPU isolation.

--

I reproduced the benchmark on my other "selma" laptop, without CPU isolation 
(so less reliable).

C benchmark:

haypo@selma$ python3 -m perf compare_to master.json ignore.json 
Mean +- std dev: [master] 932 ns +- 66 ns -> [ignore] 1.01 us +- 0.05 us: 1.09x 
slower (+9%)

==> +78 ns

--

___
Python tracker 

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



[issue32125] Remove global configuration variable Py_UseClassExceptionsFlag

2017-11-24 Thread STINNER Victor

Change by STINNER Victor :


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

___
Python tracker 

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



[issue32124] Document functions safe to be called before Py_Initialize()

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:

> Then document this explicitly like for other functions that *should* be 
> called before Py_Initialize() if called at all.

I agree that it would be even better to document if a function must not be 
called after Py_Initialize().

*But* I'm not sure of what I wrote, I have to check the code, and maybe even 
test manually to "see what happens" (ensure that it works) :-)

So I decided to push my first PR, and will work on a second PR later.

--

___
Python tracker 

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



[issue32124] Document functions safe to be called before Py_Initialize()

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 84c4b1938fade2b425ac906730beabd413de094d by Victor Stinner in 
branch 'master':
bpo-32124: Document C functions safe before init (#4540)
https://github.com/python/cpython/commit/84c4b1938fade2b425ac906730beabd413de094d


--

___
Python tracker 

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



[issue27535] Ignored ResourceWarning warnings leak memory in warnings registries

2017-11-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

These results look strange to me. I expected the same difference but smaller 
the base time.

--

___
Python tracker 

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



[issue27535] Ignored ResourceWarning warnings leak memory in warnings registries

2017-11-24 Thread STINNER Victor

Change by STINNER Victor :


Added file: https://bugs.python.org/file47287/bench_ignore_warn_c.py

___
Python tracker 

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



[issue27535] Ignored ResourceWarning warnings leak memory in warnings registries

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:

New benchmark on the emitting a warning which is ignored. Benchmark the PR 4489.


Warning emitted in Python, warnings.warn():

vstinner@apu$ ./python -m perf compare_to master.json ignore.json 
Mean +- std dev: [master] 705 ns +- 24 ns -> [ignore] 838 ns +- 18 ns: 1.19x 
slower (+19%)

==> +133 ns


Warning emitted in C, PyErr_WarnEx():

vstinner@apu$ python3 -m perf compare_to master2.json ignore2.json 
Mean +- std dev: [master2] 702 ns +- 9 ns -> [ignore2] 723 ns +- 9 ns: 1.03x 
slower (+3%)

==> +21 ns


C benchmark, attached files:

* bench_c_warn.patch
* bench_ignore_warn_c.py

--
Added file: https://bugs.python.org/file47286/bench_c_warn.patch

___
Python tracker 

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



[issue32125] Remove global configuration variable Py_UseClassExceptionsFlag

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset da9c8c36aeb60ad8f7748a735c372bf993d2e4f3 by Victor Stinner in 
branch 'master':
bpo-32125: Remove Py_UseClassExceptionsFlag flag (#4544)
https://github.com/python/cpython/commit/da9c8c36aeb60ad8f7748a735c372bf993d2e4f3


--

___
Python tracker 

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



[issue32124] Document functions safe to be called before Py_Initialize()

2017-11-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> I'm quite sure that calling PyMem_SetAllocator() or
> PyObject_SetArenaAllocator() after Py_Initialize() will quickly crash.

Then document this explicitly like for other functions that *should* be called 
before Py_Initialize() if called at all.

--

___
Python tracker 

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



[issue32124] Document functions safe to be called before Py_Initialize()

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:

> Should PyMem_SetAllocator() and PyObject_SetArenaAllocator() be called before 
> Py_Initialize(), or they can be called after it?

I'm quite sure that calling PyMem_SetAllocator() or 
PyObject_SetArenaAllocator() after Py_Initialize() will quickly crash.

> If PyMem_Malloc() and PyObject_Malloc() are not needed for 
> pre-initialization, should we support calling them before Py_Initialize()?

We don't have to support them.

Ok, I remove them from the pre-init documentation.

--

___
Python tracker 

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



[issue32125] Remove global configuration variable Py_UseClassExceptionsFlag

2017-11-24 Thread STINNER Victor

Change by STINNER Victor :


--
keywords: +patch
pull_requests: +4479
stage:  -> patch review

___
Python tracker 

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



[issue32097] doctest does not consider \r\n a

2017-11-24 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
versions:  -Python 3.4, Python 3.5, Python 3.8

___
Python tracker 

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



[issue32080] Re locale test fails after installing Python 3.6.3 on ubuntu 16.04

2017-11-24 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
components: +Installation, Library (Lib) -2to3 (2.x to 3.x conversion tool)
nosy: +serhiy.storchaka
title: Error Installing Python 3.6.3 on ubuntu 16.04 -> Re locale test fails 
after installing Python 3.6.3 on ubuntu 16.04
type: resource usage -> behavior

___
Python tracker 

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



[issue32127] tutorial on dictionaries has error in example

2017-11-24 Thread Toby Berla

Toby Berla  added the comment:

Thanks, Eric. (I'm new to Python.) Perhaps I should have paid closer attention 
to the description of the dictionary data structure -- 

"Performing list(d.keys()) on a dictionary returns a list of all the keys used 
in the dictionary, in arbitrary order"

-- rather than just jumping ahead to the code 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



[issue32127] tutorial on dictionaries has error in example

2017-11-24 Thread Eric V. Smith

Eric V. Smith  added the comment:

dict makes no guarantees on ordering, so I think the example is fine. There is 
no "correct" ordering.

--
nosy: +eric.smith

___
Python tracker 

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



[issue32127] tutorial on dictionaries has error in example

2017-11-24 Thread Toby Berla

New submission from Toby Berla :

in https://docs.python.org/3/tutorial/datastructures.html: 

-
5.5. Dictionaries
...
Here is a small example using a dictionary:

>>>
>>> tel = {'jack': 4098, 'sape': 4139}
>>> tel['guido'] = 4127
>>> tel
{'sape': 4139, 'guido': 4127, 'jack': 4098}
-

I think the order of dictionary elements shown after 'guido' is inserted is 
wrong.

The correct order is: 
{'jack': 4098, 'sape': 4139, 'guido': 4127}

--
assignee: docs@python
components: Documentation
messages: 306913
nosy: docs@python, tberla
priority: normal
severity: normal
status: open
title: tutorial on dictionaries has error in example
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



[issue32116] CSV import and export simplified

2017-11-24 Thread Paul Long

Change by Paul Long :


--
keywords: +patch
pull_requests: +4478
stage:  -> patch review

___
Python tracker 

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



[issue32124] Document functions safe to be called before Py_Initialize()

2017-11-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Should PyMem_SetAllocator() and PyObject_SetArenaAllocator() be called before 
Py_Initialize(), or they can be called after it?

If PyMem_Malloc() and PyObject_Malloc() are not needed for pre-initialization, 
should we support calling them before Py_Initialize()? There are other 
functions and macros that can be safely used before Py_Initialize().

--

___
Python tracker 

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



[issue28684] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2017-11-24 Thread Xavier de Gaye

Xavier de Gaye  added the comment:


New changeset 5742f674f7561dc9a1fc66d650e18e31b941183b by xdegaye in branch 
'master':
bpo-28684: Remove useless import added by the previous commit (GH-4547)
https://github.com/python/cpython/commit/5742f674f7561dc9a1fc66d650e18e31b941183b


--

___
Python tracker 

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



[issue32112] Should uuid.UUID() accept another UUID() instance?

2017-11-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Growing the size of the code and the documentation, complicating the mental 
model, slowing down all other cases, the risk of introducing bugs. This is the 
cost that we should pay for adding a new feature. The benefit of adding a 
feature should be larger than this cost. I'm not sure this is a case. But if 
you think it is worth, you can add it.

Note that by adding this feature you can open a can of worms and will need to 
add support of time(time), date(date), namedtuple(namedtuple), etc for the same 
reason, because some database drivers already do mapping for you.

--

___
Python tracker 

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



[issue28684] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2017-11-24 Thread Xavier de Gaye

Change by Xavier de Gaye :


--
pull_requests: +4477

___
Python tracker 

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



[issue32067] Deprecate accepting unrecognized braces in regular expressions

2017-11-24 Thread Jakub Wilk

Change by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

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



[issue32112] Should uuid.UUID() accept another UUID() instance?

2017-11-24 Thread Éric Araujo

Éric Araujo  added the comment:

I don’t see a downside in accepting the feature request here.

Maybe ask on python-ideas to get more feedback?

--
nosy: +eric.araujo

___
Python tracker 

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



[issue31706] urlencode should accept generator as values for mappings when doseq=True

2017-11-24 Thread François Freitag

François Freitag  added the comment:

I updated the PR to allow any iterable of two-elements iterables to be passed 
to urlencode.

If anyone has the time and interest, the PR is ready for review.

--

___
Python tracker 

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



[issue32126] [asyncio] test failure when the platform lacks a functional sem_open()

2017-11-24 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

See also the related issues:
#3770: test_multiprocessing fails on systems with HAVE_SEM_OPEN=0
#28668: instanciation of multiprocessing.Queue raises ImportError in 
test_logging
#26924: android: test_concurrent_futures fails

--

___
Python tracker 

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



[issue32126] [asyncio] test failure when the platform lacks a functional sem_open()

2017-11-24 Thread Xavier de Gaye

New submission from Xavier de Gaye :

test_get_event_loop_new_process fails on Android API 24 with the error:

==
ERROR: test_get_event_loop_new_process 
(test.test_asyncio.test_events.EPollEventLoopTests)
--
Traceback (most recent call last):
  File "/sdcard/org.python/lib/python3.7/multiprocessing/synchronize.py", line 
29, in 
from _multiprocessing import SemLock, sem_unlink
ImportError: cannot import name 'sem_unlink' from '_multiprocessing' 
(/data/local/tmp/python/lib/pyt
hon3.7/lib-dynload/_multiprocessing.cpython-37dm.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/sdcard/org.python/lib/python3.7/test/test_asyncio/test_events.py", 
line 2239, in test_get_e
vent_loop_new_process
self.loop.run_until_complete(main()),
  File "/sdcard/org.python/lib/python3.7/asyncio/base_events.py", line 466, in 
run_until_complete
return future.result()
  File "/sdcard/org.python/lib/python3.7/test/test_asyncio/test_events.py", 
line 2230, in main
pool = concurrent.futures.ProcessPoolExecutor()
  File "/sdcard/org.python/lib/python3.7/concurrent/futures/process.py", line 
410, in __init__
self._call_queue = mp_context.Queue(queue_size)
  File "/sdcard/org.python/lib/python3.7/multiprocessing/context.py", line 102, 
in Queue
return Queue(maxsize, ctx=self.get_context())
  File "/sdcard/org.python/lib/python3.7/multiprocessing/queues.py", line 42, 
in __init__
self._rlock = ctx.Lock()
  File "/sdcard/org.python/lib/python3.7/multiprocessing/context.py", line 66, 
in Lock
from .synchronize import Lock
  File "/sdcard/org.python/lib/python3.7/multiprocessing/synchronize.py", line 
34, in 
" function, see issue 3770.")
ImportError: This platform lacks a functioning sem_open implementation, 
therefore, the required sync
hronization primitives needed will not function, see issue 3770.

--
components: Tests, asyncio
messages: 306906
nosy: xdegaye, yselivanov
priority: normal
severity: normal
stage: needs patch
status: open
title: [asyncio] test failure when the platform lacks a functional  sem_open()
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue32089] In developer mode (-X dev), ResourceWarning is only emited once per line numbers

2017-11-24 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Antoine: What do you think of using the "default" action for pydebug build 
> and -X dev?

That would be fine with me.

--

___
Python tracker 

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



[issue28684] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2017-11-24 Thread Xavier de Gaye

Change by Xavier de Gaye :


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

___
Python tracker 

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



[issue28684] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2017-11-24 Thread Xavier de Gaye

Xavier de Gaye  added the comment:


New changeset 0f86cd38f4a38f25a4aed3759a654a4b7fa49031 by xdegaye in branch 
'master':
bpo-28684: asyncio tests handle PermissionError raised on binding unix sockets 
(GH-4503)
https://github.com/python/cpython/commit/0f86cd38f4a38f25a4aed3759a654a4b7fa49031


--

___
Python tracker 

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



[issue28684] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2017-11-24 Thread Xavier de Gaye

Change by Xavier de Gaye :


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



[issue12239] msilib VT_EMPTY SummaryInformation properties raise an error (suggest returning None)

2017-11-24 Thread Berker Peksag

Berker Peksag  added the comment:

Thanks for the patch, Mark. I updated the test code and commit it to 3.6 and 
master branches.

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

___
Python tracker 

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



[issue32124] Document functions safe to be called before Py_Initialize()

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:

> Are you sure about PyMem_Malloc() and PyObject_Malloc()?

Technically, the pymalloc memory allocator is initialized statically by the 
compiler, from the first instruction of the process.

But maybe we should not suggest users to call them, especially because the 
allocator can be modified by the PYTHONMALLOC environment variable.

> What functions require them?

No function to initalize Python require PyMem or PyObject allocators. Only 
PyMem_Raw allocator is needed.

Py_EncodeLocale() uses it, but this function also uses Python objects (str, 
bytes), and so Py_EncodeLocale() must no be called before Py_Initialize().

--

___
Python tracker 

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



[issue12239] msilib VT_EMPTY SummaryInformation properties raise an error (suggest returning None)

2017-11-24 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset 412f00b839eae2bc07ca08a8e615c3d7dc870646 by Berker Peksag in 
branch '3.6':
[3.6] bpo-12239: Make GetProperty() return None for VT_EMPTY (GH-4539)
https://github.com/python/cpython/commit/412f00b839eae2bc07ca08a8e615c3d7dc870646


--

___
Python tracker 

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



[issue32125] Remove global configuration variable Py_UseClassExceptionsFlag

2017-11-24 Thread STINNER Victor

New submission from STINNER Victor :

The Py_UseClassExceptionsFlag flag was added by the commit 
035574d755bfc306704e9975dc10e4e05a47b3bb.

The commit 757af0e7bb7c7d56670fbc84f1f5b0182a54e3d5 started to use this flag:

+   /* if Python was started with -X, initialize the class exceptions */
+   if (Py_UseClassExceptionsFlag)
+   init_class_exc(dict);

Later followed by commit 98b6246c0c60f2831b0c7a66d8c0659ebac1ec32.

The flag was finally deprecated in the commit 
3ce096459e348c95c2c3348f8d84720f25c1a4c9 in 2000.

All these changes are older than Python 2.0.

In Python 2.7 and 3.6, the flag is not used at all.

I think that it's time to remove it :-)

--
components: Interpreter Core
messages: 306900
nosy: vstinner
priority: normal
severity: normal
status: open
title: Remove global configuration variable Py_UseClassExceptionsFlag
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



[issue12239] msilib VT_EMPTY SummaryInformation properties raise an error (suggest returning None)

2017-11-24 Thread Berker Peksag

Change by Berker Peksag :


--
pull_requests: +4476

___
Python tracker 

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



[issue12239] msilib VT_EMPTY SummaryInformation properties raise an error (suggest returning None)

2017-11-24 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset 19fb134185ce155bc53f517116fca73093ba55e9 by Berker Peksag in 
branch 'master':
bpo-12239: Make GetProperty() return None for VT_EMPTY (GH-4539)
https://github.com/python/cpython/commit/19fb134185ce155bc53f517116fca73093ba55e9


--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-11-24 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4475

___
Python tracker 

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



[issue32124] Document functions safe to be called before Py_Initialize()

2017-11-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Are you sure about PyMem_Malloc() and PyObject_Malloc()? What functions require 
them? I thought only PyMem_RawMalloc() can be called before Py_Initialize().

I think that for all functions that *can* or *should* be called before 
Py_Initialize() this should be explicitly documented in the documentation of 
this function, like for Py_SetProgramName() and PyImport_AppendInittab().

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue32121] tracemalloc.Traceback.format() should have an option to reverse the traceback

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:

Serhiy:
> While we are here, what if make a negative limit truncating from the opposite 
> side, as in the traceback module?

Why not. I'm not opposed to that :-)

--

___
Python tracker 

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



[issue32096] Py_DecodeLocale() fails if used before the runtime is initialized.

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:

The test also failed on x86 Tiger 3.x:

http://buildbot.python.org/all/#/builders/30/builds/212

==
FAIL: test_pre_initialization_api (test.test_capi.EmbeddingTests)
--
Traceback (most recent call last):
  File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_capi.py", 
line 602, in test_pre_initialization_api
out, err = self.run_embedded_interpreter("pre_initialization_api", env=env)
  File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_capi.py", 
line 464, in run_embedded_interpreter
(p.returncode, err))
AssertionError: -6 != 0 : bad returncode -6, stderr is "Could not find platform 
independent libraries \nCould not find platform dependent libraries 
\nConsider setting $PYTHONHOME to [:]\nFatal 
Python error: initfsencoding: unable to load the file system 
codec\nModuleNotFoundError: No module named 'encodings'\n\nCurrent thread 
0xa000d000 (most recent call first):\n"

--

___
Python tracker 

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



[issue32096] Py_DecodeLocale() fails if used before the runtime is initialized.

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:

We now check that Py_DecodeLocale() can be called before Py_Initialize(). IMHO 
we need to document this property in the documentation: I opened bpo-32124 and 
wrote a PR for that.

--

___
Python tracker 

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



[issue32124] Document functions safe to be called before Py_Initialize()

2017-11-24 Thread STINNER Victor

Change by STINNER Victor :


--
keywords: +patch
pull_requests: +4474
stage:  -> patch review

___
Python tracker 

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



[issue32124] Document functions safe to be called before Py_Initialize()

2017-11-24 Thread STINNER Victor

New submission from STINNER Victor :

Follow-up of bpo-32086, bpo-32096 and "[Python-Dev] Python initialization and 
embedded Python" thread:
https://mail.python.org/pipermail/python-dev/2017-November/150605.html

I propose to explicitly list functions that can be safetely called before 
Py_Initialize(). This safety warranty must be part of the C API.

Maybe we should even test all tests function in test_capi using 
Programs/_testembed, as we did for Py_DecodeLocale() and Py_SetProgramName() in 
commit 9e87e7776f7ace66baaf7247233afdabd00c2b44 ("pre_initialization_api" test).

Attached PR adds proposed documentation. It also documents "global 
configuration variables" like Py_DebugFlag.

--
assignee: docs@python
components: Documentation
messages: 306894
nosy: docs@python, eric.snow, ncoghlan, vstinner
priority: normal
severity: normal
status: open
title: Document functions safe to be called before Py_Initialize()
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



[issue10544] yield expression inside generator expression does nothing

2017-11-24 Thread Armin Rigo

Change by Armin Rigo :


--
nosy:  -arigo

___
Python tracker 

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



[issue32096] Py_DecodeLocale() fails if used before the runtime is initialized.

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:

> New changeset 9e87e7776f7ace66baaf7247233afdabd00c2b44 by Victor Stinner in 
> branch 'master':
> bpo-32096: Remove obj and mem from _PyRuntime (#4532)

The newly added test failed on AMD64 Debian root 3.x:

http://buildbot.python.org/all/#/builders/27/builds/226

==
FAIL: test_pre_initialization_api (test.test_capi.EmbeddingTests)
--
Traceback (most recent call last):
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/test_capi.py", 
line 602, in test_pre_initialization_api
out, err = self.run_embedded_interpreter("pre_initialization_api", env=env)
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/test_capi.py", 
line 464, in run_embedded_interpreter
(p.returncode, err))
AssertionError: -6 != 0 : bad returncode -6, stderr is "Could not find platform 
independent libraries \nCould not find platform dependent libraries 
\nConsider setting $PYTHONHOME to [:]\nFatal 
Python error: initfsencoding: Unable to get the locale 
encoding\nModuleNotFoundError: No module named 'encodings'\n\nCurrent thread 
0x7f6456f8c700 (most recent call first):\n"

--

___
Python tracker 

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



[issue32121] tracemalloc.Traceback.format() should have an option to reverse the traceback

2017-11-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

While we are here, what if make a negative limit truncating from the opposite 
side, as in the traceback module?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-11-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> * 3.6: don't memset() --> correct, but don't detect "use after free" bug
> when a memory block is skrinked

And doesn't detect  "use after free" bug when a memory block is expanded. And 
2.7 doesn't detect this. Only 3.7 detects this.

--

___
Python tracker 

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



[issue30657] Unsafe arithmetic in PyString_DecodeEscape

2017-11-24 Thread Leo kirotawa silva

Leo kirotawa silva  added the comment:

Python 3.4 also has the similar code as 3.5, but applying the same patch tests 
for it results in test errors:

+== 

 
+ERROR: test_anydbm_creation (test.test_dbm.TestCase-dbm.ndbm)  

 
+-- 


+Traceback (most recent call last): 

   
+  File "/<>/Lib/test/test_dbm.py", line 74, in 
test_anydbm_creation^M  
   
+self.read_helper(f)^M  


+  File "/<>/Lib/test/test_dbm.py", line 115, in read_helper   

 
+self.assertEqual(self._dict[key], f[key.encode("ascii")])  

 
+KeyError: b'0' 


+   

 
+== 

 
+ERROR: test_anydbm_modification (test.test_dbm.TestCase-dbm.ndbm)  

  
+-- 


+Traceback (most recent call last): 

 
+  File "/<>/Lib/test/test_dbm.py", line 89, in 
test_anydbm_modification
   
+self.read_helper(f)


+  File "/<>/Lib/test/test_dbm.py", line 115, in read_helper   

 
+self.assertEqual(self._dict[key], f[key.encode("ascii")])  

 
+KeyError: b'0' 

 
+   


+== 

 
+ERROR: test_anydbm_read (test.test_dbm.TestCase-dbm.ndbm)  

 
+-- 

 
+Traceback (most recent call last): 

 

[issue12239] msilib VT_EMPTY SummaryInformation properties raise an error (suggest returning None)

2017-11-24 Thread Berker Peksag

Change by Berker Peksag :


--
pull_requests: +4473
stage: needs patch -> patch review

___
Python tracker 

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



[issue32096] Py_DecodeLocale() fails if used before the runtime is initialized.

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 9e87e7776f7ace66baaf7247233afdabd00c2b44 by Victor Stinner in 
branch 'master':
bpo-32096: Remove obj and mem from _PyRuntime (#4532)
https://github.com/python/cpython/commit/9e87e7776f7ace66baaf7247233afdabd00c2b44


--

___
Python tracker 

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



[issue30860] Consolidate stateful C globals under a single struct.

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 9e87e7776f7ace66baaf7247233afdabd00c2b44 by Victor Stinner in 
branch 'master':
bpo-32096: Remove obj and mem from _PyRuntime (#4532)
https://github.com/python/cpython/commit/9e87e7776f7ace66baaf7247233afdabd00c2b44


--

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-11-24 Thread STINNER Victor

Change by STINNER Victor :


--
versions: +Python 2.7

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:

Ok, let me summarize:

* 2.7: memset() *before* realloc() if shrinking a memory block, but crash when 
Py_FatalError() if realloc() fails on shrinking --> cannot corrupt memory, but 
can crash if realloc() fails on shrinking

* master (3.7): memset() *before* realloc() if shrinking a memory block, but 
save erased bytes, and restore erased bytes if realloc() fails --> always 
correct

* 3.6: don't memset() --> correct, but don't detect "use after free" bug when a 
memory block is skrinked

Python 3.6 release manager, Ned Deily, rejected the proposal to backport the 
complex fix from master to 3.6.


Victor (me):
> Serhiy: I added a Py_FatalError() to Python 2.7 if the case that must not 
> happen does happen. Are you ok to apply the same change for Python 3.6 (...)

Sorry, when I asked the question, I expected that Python 3.6 still erased bytes 
before realloc(). But it's not the case. I agree that Py_FatalError() would be 
a bad idea for Python 3.6.


Serhiy: Thank you for fixing Python 3.6 (don't memset() *after* realloc, which 
crashed on OpenBSD) and "fix" the feature in master (restore erased bytes if 
realloc fails)!


I close the issue. I don't think that Python 2.7 or 3.6 need further changes.

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

___
Python tracker 

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



[issue32121] tracemalloc.Traceback.format() should have an option to reverse the traceback

2017-11-24 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> what do you think of adding a new parameter but also **reverse frames by 
> default**?

This would be fine with me.  I didn't want to suggest it because it would break 
compatibility but obviously I find the current behaviour annoying :-)

--

___
Python tracker 

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



[issue32121] tracemalloc.Traceback.format() should have an option to reverse the traceback

2017-11-24 Thread STINNER Victor

STINNER Victor  added the comment:

tracemalloc.Traceback contains "raw" data from the C _tracemalloc module. But 
since we are at Python level, we are free to change how data is rendered to 
user.

Since Antoine Pitrou was surprised by the current frame order in 
Traceback.format() ("This is not intuitive since ordinary Python tracebacks are 
displayed in "most recent call last" order"), what do you think of adding a new 
parameter but also **reverse frames by default**?

Maybe we can go further and even reverse frames in Traceback constructor? This 
is a backward incompatible change, but I don't think that a lot of code in the 
wild uses the tracemalloc *API*.

About the parameter name: I'm ok with "reverse". *But* if we reverse by 
default, the "reverse" name can be confusing. Maybe we can use a less confusing 
name like "most_recent_last=True" (or "most_recent_first=False")?

--

Note: The faulthandler module also dumps starting with the "(most recent call 
first)", but I don't want to change that. It's for technical reason: 
faulthandler is called when something really bad happens and so Python internal 
structures may be corrupted. Moreover, frames is a single chained list, it's 
hard to iterate over them in the backward order (especially in faulthandler 
code where heap memory allocations are denied).

--

___
Python tracker 

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



[issue12382] [msilib] Obscure exception message when trying to open a non-existent MSI database

2017-11-24 Thread Berker Peksag

Berker Peksag  added the comment:

Thank you for your patch, William. I added a test case, a NEWS entry and 
committed it to 3.6 and master branches.

--
components: +Library (Lib)
nosy: +paul.moore, steve.dower, zach.ware
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.6, Python 3.7 -Python 2.7, Python 3.5

___
Python tracker 

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



[issue12382] [msilib] Obscure exception message when trying to open a non-existent MSI database

2017-11-24 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset bfa89b21e119bac7fed4a5decc26f1fff8ec359e by Berker Peksag (Miss 
Islington (bot)) in branch '3.6':
bpo-12382: Make OpenDatabase() raise better exception messages (GH-4528)
https://github.com/python/cpython/commit/bfa89b21e119bac7fed4a5decc26f1fff8ec359e


--

___
Python tracker 

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



[issue29556] Remove unused #include

2017-11-24 Thread Chi Hsuan Yen

Chi Hsuan Yen  added the comment:

As https://github.com/python/cpython/pull/98 is merged, this issue is fixed. 
Thanks haypo for the review!

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



[issue30987] Support for ISO-TP protocol in SocketCAN

2017-11-24 Thread Berker Peksag

Change by Berker Peksag :


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

___
Python tracker 

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



[issue32120] python 3.6.0 is not importing sqlite3

2017-11-24 Thread Abinaya

Abinaya  added the comment:

Is there any bug in python_v360.
Please let me know why its not supporting sqlite3.

Python-3.6.3 seems to working but It would be better if you give some 
clarification about python3.6.0.

--

___
Python tracker 

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



[issue12382] [msilib] Obscure exception message when trying to open a non-existent MSI database

2017-11-24 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4472

___
Python tracker 

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



[issue12382] [msilib] Obscure exception message when trying to open a non-existent MSI database

2017-11-24 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset 4864a619dc1cc9092780ccf5a6327e8abf66133d by Berker Peksag in 
branch 'master':
bpo-12382: Make OpenDatabase() raise better exception messages (GH-4528)
https://github.com/python/cpython/commit/4864a619dc1cc9092780ccf5a6327e8abf66133d


--

___
Python tracker 

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



[issue32123] Make the API of argparse.HelpFormatter public

2017-11-24 Thread Bernhard10

New submission from Bernhard10 :

Since there have not been any significant change to the code of 
argparse.HelpFormatter in the last few years but there are still some open 
issues where people want to customize formatting, I would like to ask: What is 
required before parts of the API of argparse.HelpFormatter can be made public?

Related issues:
https://bugs.python.org/issue17113 RawDescriptionHelpFormatter removes blank 
lines
https://bugs.python.org/issue12806 and https://bugs.python.org/issue22029 
request a formatter that (partly) wraps lines but keeps newlines.
https://bugs.python.org/issue11695 costumize usage
https://bugs.python.org/issue28742 Improve ArgumentDefaultsHelpFormatter


All this issues could be fixed outside the standard library by sub-classing 
HelpFormatter, which would require a public and documented API for it.

So my question: What is missing before HelpFormatter can get a public API and 
how can I help?

--
components: Library (Lib)
messages: 306879
nosy: Bernhard10
priority: normal
severity: normal
status: open
title: Make the API of argparse.HelpFormatter public
type: enhancement
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



[issue28334] netrc does not work if $HOME is not set

2017-11-24 Thread Berker Peksag

Change by Berker Peksag :


--
pull_requests: +4471

___
Python tracker 

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