[issue28855] Compiler warnings in _PyObject_CallArg1()

2016-12-01 Thread Benjamin Peterson
Benjamin Peterson added the comment: I also think forcing callers to cast is fine. Most of our APIs require PyObject *. -- ___ Python tracker ___

[issue23507] Tuple creation is too slow

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: haypo: "status: open -> closed" Oops, it's a mistake, sorry. I only wanted to ask the question, not to close the issue. Serhiy Storchaka: "No, I'm referring to the crashing. The code that worked before your changes now are crashing." Sorry, I didn't notice

[issue28858] Fastcall uses more C stack

2016-12-01 Thread STINNER Victor
New submission from STINNER Victor: Serhiy Storchaka reported that Python 3.6 crashs earlier than Python 3.5 on calling json.dumps() when sys.setrecursionlimit() is increased. I tested the script he wrote. Results on Python built in release mode: Python 3.7: ... 58100 116204 Segmentation

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: @Xavier: Cool, thanks for checking :-) I don't have access to an Android platform yet. -- resolution: -> fixed status: open -> closed ___ Python tracker

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Xavier de Gaye
Xavier de Gaye added the comment: Here is the output of getandroidapilevel(), a verbose run of test_sys and a run of the test suite on the Android x86 emulator API 21. All the results are as expected, the failed tests are the usual ones, BTW all of the failed tests have either a patch ready

What do you think: good idea to launch a marketplace on python+django?

2016-12-01 Thread Gus_G
Hello, what do you think about building a marketplace website on connection of python+django? End effect-side should look and work similar to these: https://zoptamo.com/uk/s-abs-c-uk, https://www.ownerdirect.com/ . What are your opinions on this idea? Maybe there is other, better way to build

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2016-12-01 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +ethan.furman, serhiy.storchaka ___ Python tracker ___

[issue5322] Python 2.6 object.__new__ argument calling autodetection faulty

2016-12-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Will commit to 3.5-3.7 after releasing 3.6.0. -- versions: -Python 2.7 ___ Python tracker ___

[issue5322] Python 2.6 object.__new__ argument calling autodetection faulty

2016-12-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset a37cc3d926ec by Serhiy Storchaka in branch '2.7': Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. https://hg.python.org/cpython/rev/a37cc3d926ec -- nosy: +python-dev ___ Python

[issue28857] SyncManager and Main Process fail to communicate after reboot or stoping with Ctrl - C

2016-12-01 Thread Nagarjuna Arigapudi
New submission from Nagarjuna Arigapudi: "SyncManager" and "Main Process" and main process look at different directories and fail to communicate, causing shutdown of all process, immediately after start of program. This behavior is seen in both 2.7 and 3.5. The logging of 2.7 is more clear,

[issue28855] Compiler warnings in _PyObject_CallArg1()

2016-12-01 Thread Benjamin Peterson
Benjamin Peterson added the comment: (Sorry, I noticed and landed a fix before completely reading the issue.) -- ___ Python tracker ___

[issue28855] Compiler warnings in _PyObject_CallArg1()

2016-12-01 Thread Benjamin Peterson
Benjamin Peterson added the comment: It doesn't seem like the question is whether to use inline functions but whether to force all callers to cast. Your original code would work if you added all the casts in your static_inline.patch patch. -- ___

[issue26861] shutil.copyfile() doesn't close the opened files

2016-12-01 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- status: open -> pending ___ Python tracker ___

[issue28855] Compiler warnings in _PyObject_CallArg1()

2016-12-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset 96245d4af0ca by Benjamin Peterson in branch 'default': fix _PyObject_CallArg1 compiler warnings (closes #28855) https://hg.python.org/cpython/rev/96245d4af0ca -- nosy: +python-dev resolution: -> fixed stage: -> resolved status: open ->

[issue28847] dumbdbm should not commit if in read mode

2016-12-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The first part is committed in 2.7. I'll commit it in 3.5-3.7 after releasing 3.6.0. -- versions: -Python 2.7 ___ Python tracker

[issue28847] dumbdbm should not commit if in read mode

2016-12-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0516f54491cb by Serhiy Storchaka in branch '2.7': Issue #28847: dubmdbm no longer writes the index file in when it is not https://hg.python.org/cpython/rev/0516f54491cb -- nosy: +python-dev ___ Python

Re: correct way to catch exception with Python 'with' statement

2016-12-01 Thread Steve D'Aprano
On Fri, 2 Dec 2016 11:26 am, DFS wrote: >> For most programs, yes, it probably will never be a problem to check >> for existence, and then assume that the file still exists.  But put that >> code on a server, and run it a couple of million times, with dozens of >> other processes also

[issue28847] dumbdbm should not commit if in read mode

2016-12-01 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka versions: +Python 2.7, Python 3.5, Python 3.6 ___ Python tracker

[issue23507] Tuple creation is too slow

2016-12-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: No, I'm referring to the crashing. The code that worked before your changes now are crashing. Please revert your changes and find a way to optimize a function calling without increasing stack consumption. -- resolution: fixed -> status: closed ->

Re: compile error when using override

2016-12-01 Thread Steve D'Aprano
On Fri, 2 Dec 2016 01:35 pm, Ho Yeung Lee wrote: > from __future__ import division > import ast > from sympy import * > x, y, z, t = symbols('x y z t') > k, m, n = symbols('k m n', integer=True) > f, g, h = symbols('f g h', cls=Function) > import inspect Neither ast nor inspect is used. Why

Re: correct way to catch exception with Python 'with' statement

2016-12-01 Thread Steve D'Aprano
On Fri, 2 Dec 2016 11:26 am, DFS wrote: > On 12/01/2016 06:48 PM, Ned Batchelder wrote: >> On Thursday, December 1, 2016 at 2:31:11 PM UTC-5, DFS wrote: >>> After a simple test below, I submit that the above scenario would never >>> occur. Ever. The time gap between checking for the file's

How to properly retrieve data using requests + bs4 from multiple pages in a site?

2016-12-01 Thread Juan C.
I'm a student and my university uses Moodle as their learning management system (LMS). They don't have Moodle Web Services enabled and won't be enabling it anytime soon, at least for students. The university programs have the following structure, for example: 1. Bachelor's Degree in Computer

Re: correct way to catch exception with Python 'with' statement

2016-12-01 Thread Ned Batchelder
On Thursday, December 1, 2016 at 7:26:18 PM UTC-5, DFS wrote: > On 12/01/2016 06:48 PM, Ned Batchelder wrote: > > On Thursday, December 1, 2016 at 2:31:11 PM UTC-5, DFS wrote: > >> After a simple test below, I submit that the above scenario would never > >> occur. Ever. The time gap between

Re: Request Help With Byte/String Problem

2016-12-01 Thread Wildman via Python-list
On Wed, 30 Nov 2016 14:39:02 +0200, Anssi Saari wrote: > There'll be a couple more issues with the printing but they should be > easy enough. I finally figured it out, I think. I'm not sure if my changes are what you had in mind but it is working. Below is the updated code. Thank you for not

Re: Request Help With Byte/String Problem

2016-12-01 Thread Wildman via Python-list
On Wed, 30 Nov 2016 07:54:45 -0500, Dennis Lee Bieber wrote: > On Tue, 29 Nov 2016 22:01:51 -0600, Wildman via Python-list > declaimed the following: > >>I really appreciate your reply. Your suggestion fixed that >>problem, however, a new error appeared. I am doing

[issue23224] LZMADecompressor object is only initialized in __init__

2016-12-01 Thread Aaron Hill
Aaron Hill added the comment: I've upload a patch which should address the issue in both the lzma and bz2 modules. -- keywords: +patch nosy: +Aaron1011 Added file: http://bugs.python.org/file45730/fix-lzma-bz2-segfaults.patch ___ Python tracker

Re: compile error when using override

2016-12-01 Thread Ho Yeung Lee
from __future__ import division import ast from sympy import * x, y, z, t = symbols('x y z t') k, m, n = symbols('k m n', integer=True) f, g, h = symbols('f g h', cls=Function) import inspect def op2(a,b): return a*b+a class AA(object): @staticmethod def

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2016-12-01 Thread Alexander Belopolsky
New submission from Alexander Belopolsky: Python 3.7.0a0 (default:be70d64bbf88, Dec 1 2016, 21:21:25) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from array import array >>> a = array('B', [1,

[issue23507] Tuple creation is too slow

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: > I opened a new issue #28852 to track this performance regression. So can I close again this issue? -- resolution: -> fixed status: open -> closed ___ Python tracker

[issue28852] sorted(range(1000)) is slower in Python 3.7 compared to Python 3.5

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: On my laptop, the revision introducing the performance regression is: --- changeset: 101858:5a62d682636e user:Brett Cannon date:Fri Jun 10 14:37:21 2016 -0700 files: Doc/library/os.rst Lib/test/test_os.py Misc/NEWS

[issue28855] Compiler warnings in _PyObject_CallArg1()

2016-12-01 Thread STINNER Victor
New submission from STINNER Victor: _PyObject_CallArg1() is the following macro: --- #define _PyObject_CallArg1(func, arg) \ _PyObject_FastCall((func), &(arg), 1) --- It works well in most cases, but my change 8f258245c391 or change b9c9691c72c5 added compiler warnings, because an argument

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: > The version > 0 check was done because sysconfig.get_config_var() returns 0 > when a variable is found as '#undef' in pyconfig.h. Oh right, I see. In this case, we don't need to have a special case in sys.getandroidapilevel(). I pushed

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset be70d64bbf88 by Victor Stinner in branch 'default': Add sys.getandroidapilevel() https://hg.python.org/cpython/rev/be70d64bbf88 -- nosy: +python-dev ___ Python tracker

Re: correct way to catch exception with Python 'with' statement

2016-12-01 Thread Ned Batchelder
On Thursday, December 1, 2016 at 2:31:11 PM UTC-5, DFS wrote: > After a simple test below, I submit that the above scenario would never > occur. Ever. The time gap between checking for the file's existence > and then trying to open it is far too short for another process to sneak > in and

Re: Can json.dumps create multiple lines

2016-12-01 Thread Cecil Westerhof
On Thursday 1 Dec 2016 23:58 CET, Peter Otten wrote: > Cecil Westerhof wrote: > >> On Thursday 1 Dec 2016 22:52 CET, Cecil Westerhof wrote: >> >>> Now I need to convert the database. But that should not be a big >>> problem. >> >> I did the conversion with: >> cursor.execute('SELECT tipID FROM

[issue2771] Test issue

2016-12-01 Thread Ezio Melotti
Ezio Melotti added the comment: Testing that the link to PR 46 works. Pull Request 46 should also be a link. PullRequest 46 too. Generally you should just use PR46. -- ___ Python tracker

Re: Can json.dumps create multiple lines

2016-12-01 Thread Peter Otten
Cecil Westerhof wrote: > On Thursday 1 Dec 2016 22:52 CET, Cecil Westerhof wrote: > >> Now I need to convert the database. But that should not be a big >> problem. > > I did the conversion with: > cursor.execute('SELECT tipID FROM tips') > ids = cursor.fetchall() > for id in ids: >

[issue26363] __builtins__ propagation is misleading described in exec and eval documentation

2016-12-01 Thread Xavier Combelle
Xavier Combelle added the comment: not an inconsisties but in the eval documentaion nothing specify that the builtins propagate between levels updates -- ___ Python tracker

Re: Error In querying Genderize.io. Can someone please help

2016-12-01 Thread John Gordon
In handa...@gmail.com writes: > import requests > import json > names={'katty','Shean','Rajat'}; > for name in names: > request_string="http://api.genderize.io/?"+name > r=requests.get(request_string) >

Re: Can json.dumps create multiple lines

2016-12-01 Thread Cecil Westerhof
On Thursday 1 Dec 2016 22:52 CET, Cecil Westerhof wrote: > Now I need to convert the database. But that should not be a big > problem. I did the conversion with: cursor.execute('SELECT tipID FROM tips') ids = cursor.fetchall() for id in ids: id = id[0]

Re: Can json.dumps create multiple lines

2016-12-01 Thread Cecil Westerhof
On Thursday 1 Dec 2016 17:55 CET, Zachary Ware wrote: > On Thu, Dec 1, 2016 at 10:30 AM, Cecil Westerhof wrote: >> I would prefer when it would generate: >> '[ >> "An array", >> "with several strings", >> "as a demo" >> ]' >> >> Is this possible, or do I have to code this

[issue27779] Sync-up docstrings in C version of the the decimal module

2016-12-01 Thread Lisa Roach
Lisa Roach added the comment: This (should) be the patch with the python docstrings copied over to the C version. -- Added file: http://bugs.python.org/file45728/docstrings.patch ___ Python tracker

Error In querying Genderize.io. Can someone please help

2016-12-01 Thread handar94
import requests import json names={'katty','Shean','Rajat'}; for name in names: request_string="http://api.genderize.io/?"+name r=requests.get(request_string) result=json.loads(r.content) Error--- Traceback (most recent call last): File

[issue26363] __builtins__ propagation is misleading described in exec and eval documentation

2016-12-01 Thread Julien Palard
Julien Palard added the comment: So, is there still an inconsistency in the documentation? -- ___ Python tracker ___

[issue28840] IDLE: Document tk's long line display limitation

2016-12-01 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- stage: -> test needed title: IDLE not handling long lines correctly -> IDLE: Document tk's long line display limitation versions: +Python 2.7, Python 3.6, Python 3.7 ___ Python tracker

[issue28840] IDLE not handling long lines correctly

2016-12-01 Thread Terry J. Reedy
Terry J. Reedy added the comment: Currently, the code displayed is the code saved and run when requested. Your idea would require that IDLE keep a 'true' copy of the code separate from the 'display' copy in the Text widget, with the two being kept in sync except in special situations such as

[issue28854] FIPS mode causes dead-lock in ssl module

2016-12-01 Thread Alex Gaynor
Changes by Alex Gaynor : -- nosy: +alex, dstufft, janssen ___ Python tracker ___ ___

[issue28854] FIPS mode causes dead-lock in ssl module

2016-12-01 Thread Christian Heimes
Christian Heimes added the comment: It's a dead lock in OpenSSL. :( if (n == CRYPTO_LOCK_RAND) { fprintf(stderr, "%s%s %i %s:%i\n", (mode & CRYPTO_READ) ? "R" : "W", (mode & CRYPTO_LOCK) ? "L" : "U", n, file, line); } test_random

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Xavier de Gaye
Xavier de Gaye added the comment: > getandroidapilevel-3.patch: Updated version of getandroidapilevel.patch: > replace "runtime" with "build time" in the doc :-) Remove also "version > 0" > check in support/__init__.py. LGTM > About the version > 0 check: would it make sense to add the check

Re: Can json.dumps create multiple lines

2016-12-01 Thread Tim Chase
On 2016-12-01 17:30, Cecil Westerhof wrote: > When I have a value dummy which contains: > ['An array', 'with several strings', 'as a demo'] > Then json.dumps(dummy) would generate: > '["An array", "with several strings", "as a demo"]' > I would prefer when it would generate: > '[ >

[issue28854] FIPS mode causes dead-lock in ssl module

2016-12-01 Thread Christian Heimes
New submission from Christian Heimes: Python's ssl module is dead-locking when OpenSSL is running in FIPS mode. I first noticed it with pip. The issue is also reproducible with Python's test suite. $ sudo touch /etc/system-fips $ OPENSSL_FORCE_FIPS_MODE=1 ./python -m test.regrtest -v

Re: Asyncio -- delayed calculation

2016-12-01 Thread Ian Kelly
On Thu, Dec 1, 2016 at 12:53 AM, Christian Gollwitzer wrote: > well that works - but I think it it is possible to explain it, without > actually understanding what it does behind the scences: > > x = foo() > # schedule foo for execution, i.e. put it on a TODO list This implies

[issue28852] sorted(range(1000)) is slower in Python 3.7 compared to Python 3.5

2016-12-01 Thread Eric N. Vander Weele
Changes by Eric N. Vander Weele : -- nosy: +ericvw ___ Python tracker ___ ___

Re: OSError: [Errno 12] Cannot allocate memory

2016-12-01 Thread duncan smith
On 01/12/16 01:12, Chris Kaynor wrote: > On Wed, Nov 30, 2016 at 4:54 PM, duncan smith wrote: >> >> Thanks. So something like the following might do the job? >> >> def _execute(command): >> p = subprocess.Popen(command, shell=False, >>

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: Sorry for mixing different issues and proposing bad alternatives. My last hope is that someone looks into lemburg's msg281253: "I don't think the sys module is the right place to put the API, since it doesn't have anything to do with the Python system

Re: Can json.dumps create multiple lines

2016-12-01 Thread John Gordon
In <87lgvz4no8@equus.decebal.nl> Cecil Westerhof writes: > I started to use json.dumps to put things in a SQLite database. But I > think it would be handy when it would be easy to change the values > manually. > When I have a value dummy which contains: > ['An array',

Re: Can json.dumps create multiple lines

2016-12-01 Thread Zachary Ware
On Thu, Dec 1, 2016 at 10:30 AM, Cecil Westerhof wrote: > I would prefer when it would generate: > '[ > "An array", > "with several strings", > "as a demo" > ]' > > Is this possible, or do I have to code this myself?

[issue28853] locals() and free variables

2016-12-01 Thread Marco Buttu
New submission from Marco Buttu: The locals() documentation [1] says that "Free variables are returned by locals() when it is called in function blocks". A free variable inside a function has a global scope, and in fact it is not returned by locals():: >>> x = 33 >>> def foo(): ...

[issue28850] Regression in Python 3: Subclassing PrettyPrinter.format doesn't work anymore

2016-12-01 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___

Can json.dumps create multiple lines

2016-12-01 Thread Cecil Westerhof
I started to use json.dumps to put things in a SQLite database. But I think it would be handy when it would be easy to change the values manually. When I have a value dummy which contains: ['An array', 'with several strings', 'as a demo'] Then json.dumps(dummy) would generate: '["An

[issue28843] asyncio.Task implemented in C loses __traceback__ for exceptions

2016-12-01 Thread Yury Selivanov
Yury Selivanov added the comment: Thanks for reviewing the patch, Inada-san. Closing the issue. -- priority: release blocker -> normal resolution: -> fixed stage: -> resolved status: open -> closed type: -> behavior ___ Python tracker

[issue28852] sorted(range(1000)) is slower in Python 3.7 compared to Python 3.5

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: Benchmark: ./python -m perf timeit -s 'x=list(range(1000))' 'sorted(x)' Python 3.6 and 3.7 compared to Python 3.5: $ python3 -m perf compare_to 3.5.json.gz 3.6.json.gz 3.7.json.gz Median +- std dev: [3.5] 18.4 us +- 0.9 us -> [3.6] 20.5 us +- 0.9 us:

[issue28843] asyncio.Task implemented in C loses __traceback__ for exceptions

2016-12-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset c9f68150cf90 by Yury Selivanov in branch '3.6': Issue #28843: Fix asyncio C Task to handle exceptions __traceback__. https://hg.python.org/cpython/rev/c9f68150cf90 New changeset a21a8943c59e by Yury Selivanov in branch 'default': Merge 3.6 (issue

[issue28851] namedtuples field_names sequence preferred

2016-12-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for the reminder. I'll make the doc updates after 3.6 is released (we're trying to not make any changes at all right now). -- resolution: -> later versions: -Python 3.3, Python 3.4, Python 3.5 ___

[issue23507] Tuple creation is too slow

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: Serhiy Storchaka: "Victor, your changes introduced a regression." I suppose that you are refering to sorted(list) which seems to be slower. Do you have a specific change in mind? As I wrote, it doesn't use a key function, and so should not be impacted by my

[issue28852] sorted(range(1000)) is slower in Python 3.7 compared to Python 3.5

2016-12-01 Thread STINNER Victor
New submission from STINNER Victor: Follow-up of my comment http://bugs.python.org/issue23507#msg282187 : "sorted(list): Median +- std dev: [3.5] 17.5 us +- 1.0 us -> [3.7] 19.7 us +- 1.1 us: 1.12x slower (+12%)" "(...) sorted(list) is slower. I don't know why sorted(list) is slower. It

Re: The Case Against Python 3

2016-12-01 Thread Ned Batchelder
On Thursday, December 1, 2016 at 9:03:46 AM UTC-5, Paul Moore wrote: > While I agree that f-strings are more dangerous than people will immediately > realise (the mere fact that we call them f-*strings* when they definitely > aren't strings is an example of that), the problem here is clearly

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Xavier de Gaye
Xavier de Gaye added the comment: @Chi Hsuan Yen And please, let us not waste any more time on lost battles, this suggestion of using sys.implementation has already been rejected at issue 27442 (see msg269748) as you must know since you were involved in the discussion there. --

[issue18971] Use argparse in the profile/cProfile modules

2016-12-01 Thread Wolfgang Maier
Wolfgang Maier added the comment: oops, typing in wrong window. Very sorry. -- nosy: +wolma title: calendar -> Use argparse in the profile/cProfile modules ___ Python tracker

[issue18971] calendar

2016-12-01 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- title: Use argparse in the profile/cProfile modules -> calendar ___ Python tracker

[issue28839] _PyFunction_FastCallDict(): replace PyTuple_New() with PyMem_Malloc()

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: I pushed th echange b9c9691c72c5 to replace PyObject_CallFunctionObjArgs() with _PyObject_CallNoArg() or _PyObject_CallArg1(). These functions are simpler and don't allocate memory on the C stack. I made similar to PyObject_CallFunctionObjArgs() in Python 3.6

[issue23507] Tuple creation is too slow

2016-12-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Victor, your changes introduced a regression. -- resolution: fixed -> status: closed -> open ___ Python tracker ___

[issue28740] Add sys.getandroidapilevel()

2016-12-01 Thread Xavier de Gaye
Xavier de Gaye added the comment: > How about renaming sys.implementation._multiarch to > sys.implementation.target_architecture and make it public? > sys.androidapilevel() sounds too specific to me. Please do not hijack this issue. The removal of sys.implementation._multiarch for Android is

[issue23507] Tuple creation is too slow

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: Serhiy: "I don't propose to commit this complicated patch, but these results can be used as a guide to the optimization of tuple creating. It is surprising to me that this patch has any effect at all." A new "fast call" calling convention was added to Python

[issue23507] Tuple creation is too slow

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: I rewrote bench_builtins.py to use my new perf module. Python 3.7 is between 1.27x and 1.42x faster than Python 3.6, but sorted(list) is slower. I don't know why sorted(list) is slower. It doesn't use a key function, and so should not be impacted by FASTCALL

[issue23507] Tuple creation is too slow

2016-12-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is an example that shows increased stack consumption. With old code it counts to 74700, with the patch it counts only to 65400. Please revert your changes. -- Added file: http://bugs.python.org/file45725/stack_overflow.py

[issue10444] A mechanism is needed to override waiting for Python threads to finish

2016-12-01 Thread Emanuel Barry
Emanuel Barry added the comment: Let's just close this. -- nosy: +ebarry resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker

[issue28835] Change in behavior when overriding warnings.showwarning and with catch_warnings(record=True)

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: It seems like a regression of Python 3.6, probably introduced by myself with add addition of warnings._showwarningmsg() and the source parameter. -- nosy: +haypo, ned.deily priority: normal -> release blocker ___

[issue10444] A mechanism is needed to override waiting for Python threads to finish

2016-12-01 Thread Michael Hughes
Michael Hughes added the comment: Given that this is from five years ago, and I've moved on, I honestly can't say I care too deeply about this. My use case was for handling threads: * created by inexperienced python programmers that don't know about daemons * using third party python scripts

[issue28638] Creating namedtuple is too slow to be used in common stdlib (e.g. functools)

2016-12-01 Thread Nick Coghlan
Nick Coghlan added the comment: The concern with using the "generate a private module that can be cached" approach is that it doesn't generalise well - any time you want to micro-optimise a new module that way, you have to add a custom Makefile rule. By contrast, Argument Clinic is a general

[issue28839] _PyFunction_FastCallDict(): replace PyTuple_New() with PyMem_Malloc()

2016-12-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The problem with C stack overflow is not new, but your patch may make it worse (I don't know if it actually make it worse). Py_EnterRecursiveCall() is used for limiting Python stack. It can't prevent C stack overflow. --

[issue28851] namedtuples field_names sequence preferred

2016-12-01 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: docs@python -> rhettinger nosy: +rhettinger ___ Python tracker ___

[issue23507] Tuple creation is too slow

2016-12-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think it would be better to optimize PyObject_CallFunctionObjArgs(). -- ___ Python tracker ___

[issue23507] Tuple creation is too slow

2016-12-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset b9c9691c72c5 by Victor Stinner in branch 'default': Replace PyObject_CallFunctionObjArgs() with fastcall https://hg.python.org/cpython/rev/b9c9691c72c5 -- nosy: +python-dev ___ Python tracker

[issue28638] Creating namedtuple is too slow to be used in common stdlib (e.g. functools)

2016-12-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Argument Clinic is not needed, since we can use Makefile. -- Added file: http://bugs.python.org/file45724/functools-CacheInfo-Makefile.patch ___ Python tracker

Re: The Case Against Python 3

2016-12-01 Thread Paul Moore
On Tuesday, 29 November 2016 01:01:01 UTC, Chris Angelico wrote: > So what is it that's trying to read something and is calling an > f-string a mere string? gettext.c2py: """Gets a C expression as used in PO files for plural forms and returns a Python lambda function that implements an

[issue28851] namedtuples field_names sequence preferred

2016-12-01 Thread Francesco Grondona
New submission from Francesco Grondona: A change by mhettinger in the doc of Python 2 years ago implicitely stated a sequence of strings as preferred way to provide 'field_names' to a namedtuple: https://github.com/python/cpython/commit/7be6326e09f2062315f995a18ab54baedfd0c0ff Same change

[issue28733] Show how to use mock_open in modules other that __main__

2016-12-01 Thread Michał Bultrowicz
Michał Bultrowicz added the comment: One more update - I had the problem, because I was using monkeypatch.setattr() from Pytest, and assumed that it will work the same as patch(). This assumption turned out to be wrong. -- ___ Python tracker

[issue28839] _PyFunction_FastCallDict(): replace PyTuple_New() with PyMem_Malloc()

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: > I agree with Josh, PyTuple_New() can be faster than PyMem_Malloc() due to > tuple free list. According to benchmarks, PyTuple_New() is slower than PyMem_Malloc(). It's not surprising for me, using a tuple object requires extra work: * Track and then

[issue27172] Undeprecate inspect.getfullargspec()

2016-12-01 Thread Nick Coghlan
Nick Coghlan added the comment: Updated patch adding What's New and NEWS entries, and addressing Martin's review comments (mostly by accepting his suggestions). I ended up leaving `inspect.getcallargs()` deprecated, and instead added a comment to issue 20438 noting how to achieve the bound

[issue20438] inspect: Deprecate getfullargspec?

2016-12-01 Thread Nick Coghlan
Nick Coghlan added the comment: Noting for the record, as the general way of querying an unbound method for the name of the first parameter and adding it to the bound arguments: def add_instance_arg(callable, bound_args): try: self = callable.__self__ func =

[issue28638] Creating namedtuple is too slow to be used in common stdlib (e.g. functools)

2016-12-01 Thread INADA Naoki
INADA Naoki added the comment: (reopen the issue to discuss about using Argument Clinic) -- resolution: rejected -> status: closed -> open ___ Python tracker

[issue28699] Imap from ThreadPool behaves unexpectedly

2016-12-01 Thread fiete
fiete added the comment: Since the only thing I know about the multiprocessing internals is what I just read in the source code trying to debug my imap_unordered call, I'll add the following example, not knowing whether this is already covered by everything you have until now. import

[issue28847] dumbdbm should not commit if in read mode

2016-12-01 Thread Jonathan Ng
Jonathan Ng added the comment: #1 makes sense to be backported. On Thu, Dec 1, 2016 at 8:41 PM, Serhiy Storchaka wrote: > > Serhiy Storchaka added the comment: > > This example is too artificial. > > But there is a real issue: opening read-only files in read mode.

[issue28839] _PyFunction_FastCallDict(): replace PyTuple_New() with PyMem_Malloc()

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: Serhiy: "small_stack increases C stack consumption even for calls without keyword arguments. This is serious problem since we can't control stack overflow." This problem is not new and is worked around by Py_EnterRecursiveCall() macro which counts the depth

[issue28839] _PyFunction_FastCallDict(): replace PyTuple_New() with PyMem_Malloc()

2016-12-01 Thread STINNER Victor
STINNER Victor added the comment: > Note: Using a simple printf() in the C code, I noticed that it is not > uncommon that _PyFunction_FastCallDict() is called with an empty dictionary > for keyword arguments. Simplified Python example where _PyFunction_FastCallDict() is called with an empty

[issue28847] dumbdbm should not commit if in read mode

2016-12-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This example is too artificial. But there is a real issue: opening read-only files in read mode. Currently this causes a PermissionError on closing. For backward compatibility flags 'r' and 'w' are ignored. I.e. opening with 'r' and 'w' creates a file if

[issue28847] dumbdbm should not commit if in read mode

2016-12-01 Thread Jonathan Ng
Jonathan Ng added the comment: I'm not sure how to create an OSError. But perhaps something like this: ''' from dbm import dumb import os db = dumb.open('temp', flag='n') db['foo'] = 'bar' db.close() db = dumb.open('temp', flag='r') print(len(db.keys())) db.close os.rename('temp.dir',

[issue26363] __builtins__ propagation is misleading described in exec and eval documentation

2016-12-01 Thread Xavier Combelle
Xavier Combelle added the comment: Hi Julien, You are fully right that it is the builtin module dictionnary which is inserted in eval or exec context. However, if a "__builtins__" entry is passed to eval or exec, this builtin module dictionnary is modified hence the following work: >>>

[issue17490] Improve ast.literal_eval test suite coverage

2016-12-01 Thread Nick Coghlan
Nick Coghlan added the comment: Right, the only reason this is still open is because I thought the extra test cases might be interesting in their own right (just not interesting enough to sit down and apply). -- ___ Python tracker

  1   2   >