[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-05 Thread Warren Weckesser
Change by Warren Weckesser : -- keywords: +patch pull_requests: +16189 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16601 ___ Python tracker

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-05 Thread Warren Weckesser
Warren Weckesser added the comment: The premature return on ZeroDivisionError also causes an inconsistency in how types are handled. For example, >>> harmonic_mean([1, 0, "foo"]) 0 We get an error as expected if "foo" occurs before 0: >>> harmonic_mean([1, "foo", 0]) Traceback (most

[issue37736] asyncio.wait_for is still confusing

2019-10-05 Thread Caleb Hattingh
Caleb Hattingh added the comment: > asyncio.wait_for is still confusing Perhaps the confusion can be fixed with improvements to the docs? To me, these specific docs seem pretty clear now, but I might not be a good judge of that. > However, we still have the case where a misbehaving Task can

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-05 Thread Warren Weckesser
New submission from Warren Weckesser : The function statistics.harmonic_mean is supposed to raise a StatisticsError if any element in the input is negative. It fails to do so if the negative element is preceded by a zero. When there is a zero before the negative element, the function

Re: ipython in different loctions.

2019-10-05 Thread Cameron Simpson
On 03Oct2019 00:45, Hongyi Zhao wrote: On Thu, 03 Oct 2019 10:19:23 +1000, Cameron Simpson wrote: bash -x ~/.pyenv/shims/ipython3 and see what its final command does. Tried as follows: - werner@localhost:~$ bash -x ~/.pyenv/shims/ipython3 [...] + exec

[issue22257] PEP 432 (PEP 587): Redesign the interpreter startup sequence

2019-10-05 Thread Nick Coghlan
Nick Coghlan added the comment: Agreed. I've also added PEP 587 to the issue title to make the connection to that PEP more obvious. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed title: PEP 432: Redesign the interpreter startup sequence -> PEP 432

[issue18578] Rename and document test.bytecode_helper as test.support.bytecode_helper

2019-10-05 Thread Nick Coghlan
Nick Coghlan added the comment: Just noting for the record that the reason a new warning wasn't needed here is because there is already a general "No compatibility guarantees" warning for the entire test package: https://docs.python.org/3/library/test.html Thanks for getting this resolved!

[issue38364] inspect.iscoroutinefunction / isgeneratorfunction / isasyncgenfunction can't handle partialmethod objects

2019-10-05 Thread Martijn Pieters
Change by Martijn Pieters : -- keywords: +patch pull_requests: +16188 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16600 ___ Python tracker ___

[issue38380] Update SQLite to 3.30 in Windows and macOS installer builds

2019-10-05 Thread Ned Deily
Ned Deily added the comment: I verified it is exploitable via the sqlite3 module by adapting the test case from the SQLite ticket (https://www.sqlite.org/src/info/e4598ecbdd18bd82). But since it requires the exploiter to be able to specify raw SQL statements, it doesn't sound like it needs

[issue38381] Possible wordcode optimization for STORE/LOAD pairs

2019-10-05 Thread Raymond Hettinger
New submission from Raymond Hettinger : In the show code below, the STORE_FAST x is FOLLOWED by LOAD_FAST x. This is a common word code pairing. Perhaps a new combined opcode would help: case TARGET(LOAD_AND_STORE_FAST): { PyObject *value = GETLOCAL(oparg);

[issue38380] Update SQLite to 3.30 in Windows and macOS installer builds

2019-10-05 Thread Big Stone
New submission from Big Stone : there is a security fix in sqlite-3.30 https://nvd.nist.gov/vuln/detail/CVE-2019-16168#VulnChangeHistorySection https://www.sqlite.org/releaselog/3_30_0.html -- messages: 354023 nosy: Big Stone priority: normal severity: normal status: open title:

[issue38295] test_relative_path of test_py_compile fails on macOS 10.15 Catalina

2019-10-05 Thread Ned Deily
Ned Deily added the comment: Also the similar single test in 2.7.x fails on 10.15 (pre-release): == ERROR: test_relative_path (test.test_py_compile.PyCompileTests)

[issue36161] Use thread-safe functions instead of unsafe ones (crypt, ttyname)

2019-10-05 Thread Antonio Gutierrez
Change by Antonio Gutierrez : -- pull_requests: +16187 pull_request: https://github.com/python/cpython/pull/16599 ___ Python tracker ___

[issue38324] [Windows] test_locale and test__locale failures on Windows

2019-10-05 Thread Eryk Sun
Eryk Sun added the comment: Terry, the test_winconsoleio problem is issue 38325. Test cases with surrogate pairs that are known to fail in recent builds of Windows 10 have to be split out. For the "ps_AF" locale failure that you noted, in my case with Windows 10 18362, I have to first

Get __name__ in C extension module

2019-10-05 Thread Ian Pilcher
On 10/4/19 4:30 PM, Ian Pilcher wrote: Ideally, I would pass my existing Logging.logger object into my C function and use PyObject_CallMethod to call the appropriate method on it (info, debug, etc.). As I've researched this further, I've realized that this isn't the correct approach. My

[issue36356] Failure to build with address sanitizer

2019-10-05 Thread Ben Harper
Change by Ben Harper : -- pull_requests: +16186 pull_request: https://github.com/python/cpython/pull/16598 ___ Python tracker ___

[issue38379] finalizer resurrection in gc

2019-10-05 Thread Tim Peters
New submission from Tim Peters : While people are thinking about gc, zleak.py shows a small bug, and a possible opportunity for improvement, in the way gc treats finalizers that resurrect objects. The bug: the stats keep claiming gc is collecting an enormous number of objects, but in fact

Re: pre-edit stuff persists in a reloaded a module

2019-10-05 Thread Terry Reedy
On 10/5/2019 10:49 AM, Dennis Lee Bieber wrote: On Sat, 5 Oct 2019 16:24:14 +0200, Friedrich Rentsch declaimed the following: Thank you, Peter. I guess, then, that not only 'inspect', but the compiler as well reads source off the line cache and clearing the latter would make 'reload' work as

Re: pre-edit stuff persists in a reloaded a module

2019-10-05 Thread Peter Otten
Friedrich Rentsch wrote: > > > On 10/5/19 2:48 PM, Peter Otten wrote: >> Friedrich Rentsch wrote: >> >>> Hi all, >>> >>> Python 2.7. I habitually work interactively in an Idle window. >>> Occasionally I correct code, reload and find that edits fail to load. I >>> understand that reloading is

Re: pre-edit stuff persists in a reloaded a module

2019-10-05 Thread Terry Reedy
On 10/5/2019 10:24 AM, Friedrich Rentsch wrote: Thank you, Peter. I guess, then, that not only 'inspect', but the compiler as well reads source off the line cache and clearing the latter would make 'reload' work as expected. Are there other snags lurking, that you advise against using

[issue38332] invalid content-transfer-encoding in encoded-word causes KeyError

2019-10-05 Thread miss-islington
Change by miss-islington : -- pull_requests: +16185 pull_request: https://github.com/python/cpython/pull/16597 ___ Python tracker ___

[issue38332] invalid content-transfer-encoding in encoded-word causes KeyError

2019-10-05 Thread miss-islington
Change by miss-islington : -- pull_requests: +16184 pull_request: https://github.com/python/cpython/pull/16596 ___ Python tracker ___

[issue38332] invalid content-transfer-encoding in encoded-word causes KeyError

2019-10-05 Thread Abhilash Raj
Abhilash Raj added the comment: New changeset 65dcc8a8dc41d3453fd6b987073a5f1b30c5c0fd by Abhilash Raj (Andrei Troie) in branch 'master': bpo-38332: Catch KeyError from unknown cte in encoded-word. (GH-16503) https://github.com/python/cpython/commit/65dcc8a8dc41d3453fd6b987073a5f1b30c5c0fd

[issue38349] Email example using imaginary library installation error.

2019-10-05 Thread Abhilash Raj
Abhilash Raj added the comment: We could move that comment to the top near the import, I am totally fine with that. -- ___ Python tracker ___

[issue38349] Email example using imaginary library installation error.

2019-10-05 Thread jackotonye
jackotonye added the comment: I’m fine with closing the issue. Seems trivial now after reading the comments but noting that most developers take examples as running code and spend less time going over the comments and a dependency that had similar names makes it even harder to make the

[issue38349] Email example using imaginary library installation error.

2019-10-05 Thread Abhilash Raj
Abhilash Raj added the comment: The comment should make it clear that it is an made up imaginary module. The no dependencies outside of standard library is not written, I guess? -- ___ Python tracker

[issue38349] Email example using imaginary library installation error.

2019-10-05 Thread Abhilash Raj
Abhilash Raj added the comment: The function of this imaginary method is described below: # The magic_html_parser has to rewrite the href="cid:" attributes to # point to the filenames in partfiles. It also has to do a safety-sanitize # of the html. It could be written using

[issue38376] ./configure --with-assertions generates a broken build

2019-10-05 Thread Thomas Wouters
Thomas Wouters added the comment: The problem is _PyUnicode_CheckConsistency switched from being only defined when Py_DEBUG is set, to being defined unconditionally. That was a good change, but it made the API-compatibility hack of #defining _PyUnicode_CheckConsistency in

[issue38376] ./configure --with-assertions generates a broken build

2019-10-05 Thread Thomas Wouters
Change by Thomas Wouters : -- keywords: +patch pull_requests: +16183 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16594 ___ Python tracker ___

[issue38378] os.sendfile() has improperly named parameter

2019-10-05 Thread Zackery Spytz
Zackery Spytz added the comment: See also bpo-15078. -- nosy: +ZackerySpytz ___ Python tracker ___ ___ Python-bugs-list mailing

[issue38378] os.sendfile() has improperly named parameter

2019-10-05 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : os.sendfile() has a keyword-or-positional parameter named "in". Since it is a keyword in Python, it is not possible to pass it as a keyword argument. You can only pass it as a positional argument or using a var-keyword argument (unlikely anybody uses

Re: pre-edit stuff persists in a reloaded a module

2019-10-05 Thread Friedrich Rentsch
On 10/5/19 2:48 PM, Peter Otten wrote: Friedrich Rentsch wrote: Hi all, Python 2.7. I habitually work interactively in an Idle window. Occasionally I correct code, reload and find that edits fail to load. I understand that reloading is not guaranteed to reload everything, but I don't

[issue38376] ./configure --with-assertions generates a broken build

2019-10-05 Thread Vinay Sajip
Vinay Sajip added the comment: Adding Thomas and Victor based on git blame on some of the source lines concerned. -- nosy: +twouters, vstinner ___ Python tracker ___

[issue38377] test_asyncio.test_events.GetEventLoopTestsMixin.test_get_event_loop_new_process mixin breaks in the Unix environment without working /dev/shm

2019-10-05 Thread Matej Cepl
Change by Matej Cepl : -- keywords: +patch pull_requests: +16182 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16593 ___ Python tracker ___

[issue38377] test_asyncio.test_events.GetEventLoopTestsMixin.test_get_event_loop_new_process mixin breaks in the Unix environment without working /dev/shm

2019-10-05 Thread Matej Cepl
New submission from Matej Cepl : == ERROR: test_get_event_loop_new_process (test.test_asyncio.test_events.TestCGetEventLoop) -- Traceback (most recent call

[issue38375] Enum lookup fails for callable values

2019-10-05 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Some relevant threads * https://stackoverflow.com/questions/40338652/how-to-define-enum-values-that-are-functions * https://mail.python.org/pipermail/python-ideas/2017-April/045428.html -- ___ Python

[issue38375] Enum lookup fails for callable values

2019-10-05 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: https://docs.python.org/3/library/enum.html#allowed-members-and-attributes-of-enumerations > The rules for what is allowed are as follows: names that start and end with a > single underscore are reserved by enum and cannot be used; all other >

Re: pre-edit stuff persists in a reloaded a module

2019-10-05 Thread Peter Otten
Friedrich Rentsch wrote: > Hi all, > > Python 2.7. I habitually work interactively in an Idle window. > Occasionally I correct code, reload and find that edits fail to load. I > understand that reloading is not guaranteed to reload everything, but I > don't understand the exact mechanism and

[issue38376] ./configure --with-assertions generates a broken build

2019-10-05 Thread Vinay Sajip
Vinay Sajip added the comment: BTW it also seems to fail when just Py_DEBUG is specified (no --with-assertions). -- ___ Python tracker ___

[issue38376] ./configure --with-assertions generates a broken build

2019-10-05 Thread Vinay Sajip
New submission from Vinay Sajip : Following ./configure --prefix=$HOME/.local --with-assertions and then running make leads to an error: $ make gcc -pthread -c -Wno-unused-result -Wsign-compare -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter

[issue38335] simplify overlaps function in ipaddress.py

2019-10-05 Thread Sanjay
Sanjay added the comment: the version in the patch is less code a or b or c or d becomes a or d the version in PR is using the subnet_of, supernet_of function because overlap means either a is subnet_of or supernet_of b. So was trying to consolidate the implementation of overlap from 2 to

[issue38335] simplify overlaps function in ipaddress.py

2019-10-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is the benefit of your version? -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue38375] Enum lookup fails for callable values

2019-10-05 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38375] Enum lookup fails for callable values

2019-10-05 Thread Massimo
New submission from Massimo : ``` from enum import Enum class T(Enum): TEST = 1 print(T["TEST"]) class S(Enum): TEST = lambda a: a print(S["TEST"]) ``` fails with `KeyError: 'TEST'` on the last line. -- components: Interpreter Core messages: 354003 nosy: typish priority: normal

pre-edit stuff persists in a reloaded a module

2019-10-05 Thread Friedrich Rentsch
Hi all, Python 2.7. I habitually work interactively in an Idle window. Occasionally I correct code, reload and find that edits fail to load. I understand that reloading is not guaranteed to reload everything, but I don't understand the exact mechanism and would appreciate some illumination.

[issue38346] Wrong behavior when using `assert_called_with` with mutable object

2019-10-05 Thread Mario Corchero
Mario Corchero added the comment: Thanks! We can look at adding a copying mock if we see people needing it, but yeah, adding copy by default would be quite complex if we don't want to break existing users. -- stage: -> resolved status: open -> closed

[issue14364] Argparse incorrectly handles '--' as argument to option

2019-10-05 Thread hai shi
hai shi added the comment: Hi, Jonas. Thanks for your report. Let us wait core team's discuss;) -- ___ Python tracker ___ ___

[issue38266] Revert bpo-37878: Make PyThreadState_DeleteCurrent() Internal

2019-10-05 Thread STINNER Victor
STINNER Victor added the comment: > This is great -- thank you for handling this so quickly. Thanks for testing the master branch and reporting regressions quickly as well ;-) -- ___ Python tracker

[issue38308] Add optional weighting to statistics.harmonic_mean()

2019-10-05 Thread Dong-hee Na
Dong-hee Na added the comment: Oh.. Thank you for letting me know -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue33714] module can set an exception in tp_clear

2019-10-05 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +16181 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16592 ___ Python tracker

[issue38349] Email example using imaginary library installation error.

2019-10-05 Thread SilentGhost
SilentGhost added the comment: One fairly naive solution would be to define a magic_html_parser directly in the example and move explanatory comment there. In order not to break the code it could return an empty string. -- ___ Python tracker

[issue38349] Email example using imaginary library installation error.

2019-10-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: The rest of the overly long title was "The install shows that it only supports python 2.x but is listed under python 3.6+ docs." The lines in question are from the 2nd to last example. # An imaginary module that would make this work and be safe. from

[issue38345] Add end lines to pyclbr objects

2019-10-05 Thread Terry J. Reedy
New submission from Terry J. Reedy : I am closing this for now because there is no information upon which to proceed, and because you closed your PR (without explanation). The nested dicts returned by pyclbr already constitute a tree of nesting relationships between the functions and

[issue38331] Exec not recognizing global variables inside function

2019-10-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: Ronald is correct, and for the reason given. Python functions are lexically scoped, not dynamically scoped, and you are expecting the latter. The exec global and local namespaces are used to resolve identifier in the code you pass. Your first example

[issue38324] [Windows] test_locale and test__locale failures on Windows

2019-10-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: I started a report on failures on my machine a few days ago, but never finished editing. I am pasting in what I wrote so far. The same 4 tests fail today with a rebuild 12 hours ago. --- I ran the test suite on my 64-bit Win10 machine with fresh debug 32