Re: Appending an asterisk to the end of each line

2016-07-05 Thread Larry Hudson via Python-list
On 07/05/2016 03:05 PM, Seymore4Head wrote: import os f_in = open('win.txt', 'r') f_out = open('win_new.txt', 'w') for line in f_in.read().splitlines(): f_out.write(line + " *\n") f_in.close() f_out.close() os.rename('win.txt', 'win_old.txt') os.rename('win_new.txt', 'win.txt') I just

Re: Spot the bug: getoptquestion.py

2016-07-05 Thread Chris Angelico
On Wed, Jul 6, 2016 at 2:04 PM, Lawrence D’Oliveiro wrote: > On Tuesday, July 5, 2016 at 1:42:42 AM UTC+12, Chris Angelico wrote: > >> The getopt module is designed to match the C getopt function, which I've >> never used; for my command-line parsing, I use argparse

Re: Spot the bug: getoptquestion.py

2016-07-05 Thread Lawrence D’Oliveiro
On Tuesday, July 5, 2016 at 1:42:42 AM UTC+12, Chris Angelico wrote: > The getopt module is designed to match the C getopt function, which I've > never used; for my command-line parsing, I use argparse instead > (usually via some wrapper that cuts down the duplication, like clize). getopt seems

[issue27458] Allow subtypes of unicode/str to hit the optimized unicode_concatenate block

2016-07-05 Thread Ammar Askar
Ammar Askar added the comment: Thank you very much for the prompt feedback. I didn't even realize there was a __radd__ method, great catch. I've fixed this and added an appropriate test. Very good point about the interning. Seeing as its an implementation detail, I've changed the interned

[issue27458] Allow subtypes of unicode/str to hit the optimized unicode_concatenate block

2016-07-05 Thread Ammar Askar
Changes by Ammar Askar : Removed file: http://bugs.python.org/file43631/python.diff ___ Python tracker ___

[issue24557] Refactor LibreSSL / EGD detection

2016-07-05 Thread Larry Hastings
Larry Hastings added the comment: At this point you're not adding this to 3.5. -- versions: -Python 3.5 ___ Python tracker ___

Re: How well do you know Python?

2016-07-05 Thread Lawrence D’Oliveiro
On Tuesday, July 5, 2016 at 9:51:21 PM UTC+12, Jussi Piitulainen wrote: > > Chris Angelico writes: > >> Then hash randomization kicks in, and you can run the exact same line >> of code multiple times and get different results. It's a coin toss. > > Oh, nice, a new way to generate random bits in

[issue24557] Refactor LibreSSL / EGD detection

2016-07-05 Thread Larry Hastings
Changes by Larry Hastings : -- nosy: -larry ___ Python tracker ___ ___ Python-bugs-list

Re: Making Classes Subclassable

2016-07-05 Thread Lawrence D’Oliveiro
On Monday, July 4, 2016 at 7:58:07 PM UTC+12, dieter wrote: > > Lawrence D’Oliveiro writes: > > > Some of the classes in Qahirah, my Cairo binding > I found handy to reuse elsewhere, for > example in my binding for Pixman . >

Re: Two curious errors when function globals are manipulated

2016-07-05 Thread Steven D'Aprano
On Wed, 6 Jul 2016 02:13 am, eryk sun wrote: > On Tue, Jul 5, 2016 at 3:50 PM, Steven D'Aprano > wrote: >> It works with exec: [...] > No, actually it doesn't work. Remember that when you store to a > variable, it's implicitly a local variable, for which CPython uses >

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Steven D'Aprano
On Wed, 6 Jul 2016 10:05 am, Seymore4Head wrote: > On Wed, 6 Jul 2016 01:05:12 +0100, MRAB > wrote: >>That suggests to me that it's an encoding problem (the traceback >>would've indicated that). >> >>Specify an encoding when you open the files: >> >>f_in =

Re: Making Classes Subclassable

2016-07-05 Thread Lawrence D’Oliveiro
On Wednesday, July 6, 2016 at 3:03:26 AM UTC+12, Ian wrote: > > On Mon, Jul 4, 2016 at 2:34 AM, Lawrence D’Oliveiro wrote: >> >> On Monday, July 4, 2016 at 7:58:07 PM UTC+12, dieter wrote: >>> --> "type(obj)" or "obj.__class__" (there are small differences) >>> give you the type/class of "obj". >>

Re: Appending an asterisk to the end of each line

2016-07-05 Thread MRAB
On 2016-07-06 01:05, Seymore4Head wrote: On Wed, 6 Jul 2016 01:05:12 +0100, MRAB wrote: On 2016-07-06 00:45, Seymore4Head wrote: On Tue, 05 Jul 2016 19:29:21 -0400, Seymore4Head wrote: On Tue, 5 Jul 2016 19:15:23 -0400, Joel

[issue27459] unintended changes occur when dealing with list of list

2016-07-05 Thread Zhihan Chen
Zhihan Chen added the comment: Oh I am really sorry for my carelessness. Please accept my apology. and thank you Steven, I will pay special attention to that. -- ___ Python tracker

[issue27452] IDLE: Cleanup config code

2016-07-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: Ah, the invocation I did not test ;-). It does not matter in this case because "os.path.dirname('config.py')" is '' and the join leaves relative names for the config files that work fine for opening them.

[issue27452] IDLE: Cleanup config code

2016-07-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset adbeef96ae95 by Terry Jan Reedy in branch 'default': Issue #27452: make command line idle-test> python test_help.py work. https://hg.python.org/cpython/rev/adbeef96ae95 -- ___ Python tracker

[issue27454] PyUnicode_InternInPlace can use PyDict_SetDefault

2016-07-05 Thread INADA Naoki
INADA Naoki added the comment: Thank you for pointing it out. That comment seems useless when removing PyDict_GetItem(). So I removed it. -- Added file: http://bugs.python.org/file43634/intern-setdefault2.patch ___ Python tracker

[issue27458] Allow subtypes of unicode/str to hit the optimized unicode_concatenate block

2016-07-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: I haven't studied your code in detail (I won't be qualified to judge it) but I notice this comment: /* Hit the faster unicode_concatenate method if and only if all the following conditions are true: 1. The left operand is a unicode type 2.

[issue27459] unintended changes occur when dealing with list of list

2016-07-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Zhihan Chen, I see this issue is closed, but for future reference please don't post screenshots to report issues unless they are really needed. For text output, just copy the text from your terminal and paste it into your bug report. Making a screen shot

Re: Creating a calculator

2016-07-05 Thread BartC
On 02/07/2016 01:16, DFS wrote: On 7/1/2016 5:34 AM, Pierre-Alain Dorange wrote: More reduced : -- u=raw_input('Enter calculation:") print eval(u) -- works and compute : 1+2+3+4-1+4*2 2+3.0/2-0.5 Perform better and shorter, but

[issue27459] unintended changes occur when dealing with list of list

2016-07-05 Thread Eryk Sun
Eryk Sun added the comment: This is by design. Please read the answer for the frequently asked question "How do I create a multidimensional list?": https://docs.python.org/3/faq/programming.html#how-do-i-create-a-multidimensional-list -- nosy: +eryksun resolution: -> not a bug stage:

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Wed, 6 Jul 2016 01:05:12 +0100, MRAB wrote: >On 2016-07-06 00:45, Seymore4Head wrote: >> On Tue, 05 Jul 2016 19:29:21 -0400, Seymore4Head >> wrote: >> >>>On Tue, 5 Jul 2016 19:15:23 -0400, Joel Goldstick >>>

[issue27452] IDLE: Cleanup config code

2016-07-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset da83e115afea by Terry Jan Reedy in branch '2.7': Issue #27452: add line counter and crc to IDLE configHandler test dump. https://hg.python.org/cpython/rev/da83e115afea New changeset 127569004538 by Terry Jan Reedy in branch '3.5': Issue #27452: add

[issue27459] unintended changes occurs when dealing with list of list

2016-07-05 Thread Zhihan Chen
New submission from Zhihan Chen: When creating list of list with multiplication, changing one element of a list will result in changing all lists. -- components: Demos and Tools files: Screenshot from 2016-07-05 16-44-14.png messages: 269858 nosy: Zhihan Chen priority: normal severity:

Re: Appending an asterisk to the end of each line

2016-07-05 Thread MRAB
On 2016-07-06 00:45, Seymore4Head wrote: On Tue, 05 Jul 2016 19:29:21 -0400, Seymore4Head wrote: On Tue, 5 Jul 2016 19:15:23 -0400, Joel Goldstick wrote: On Tue, Jul 5, 2016 at 7:03 PM, MRAB wrote: On

[issue27459] unintended changes occur when dealing with list of list

2016-07-05 Thread Zhihan Chen
Changes by Zhihan Chen : -- title: unintended changes occurs when dealing with list of list -> unintended changes occur when dealing with list of list ___ Python tracker

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Wed, 6 Jul 2016 09:38:47 +1000, Chris Angelico wrote: >On Wed, Jul 6, 2016 at 9:04 AM, Seymore4Head > wrote: >> I am using XP and launching the program from another drive/folder than >> the boot drive. >> >> The program has .py extension and the

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Tue, 05 Jul 2016 19:29:21 -0400, Seymore4Head wrote: >On Tue, 5 Jul 2016 19:15:23 -0400, Joel Goldstick > wrote: > >>On Tue, Jul 5, 2016 at 7:03 PM, MRAB wrote: >>> On 2016-07-05 23:05, Seymore4Head wrote:

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Tue, 5 Jul 2016 19:15:23 -0400, Joel Goldstick wrote: >On Tue, Jul 5, 2016 at 7:03 PM, MRAB wrote: >> On 2016-07-05 23:05, Seymore4Head wrote: >>> >>> import os >>> >>> f_in = open('win.txt', 'r') >>> f_out = open('win_new.txt', 'w') >>>

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Chris Angelico
On Wed, Jul 6, 2016 at 9:04 AM, Seymore4Head wrote: > I am using XP and launching the program from another drive/folder than > the boot drive. > > The program has .py extension and the icon shows it is associated with > Python. > > I tried "start run" and then typed

[issue27456] TCP_NODELAY

2016-07-05 Thread Yury Selivanov
Yury Selivanov added the comment: PR: https://github.com/python/asyncio/pull/373 -- ___ Python tracker ___

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Wed, 6 Jul 2016 00:03:29 +0100, MRAB wrote: >On 2016-07-05 23:05, Seymore4Head wrote: >> import os >> >> f_in = open('win.txt', 'r') >> f_out = open('win_new.txt', 'w') >> >> for line in f_in.read().splitlines(): >> f_out.write(line + " *\n") >> >> f_in.close()

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Joel Goldstick
On Tue, Jul 5, 2016 at 7:03 PM, MRAB wrote: > On 2016-07-05 23:05, Seymore4Head wrote: >> >> import os >> >> f_in = open('win.txt', 'r') >> f_out = open('win_new.txt', 'w') >> >> for line in f_in.read().splitlines(): >> f_out.write(line + " *\n") >> >> f_in.close()

Re: Need help compiling Python-devel

2016-07-05 Thread Lawrence D’Oliveiro
On Wednesday, July 6, 2016 at 4:35:54 AM UTC+12, TM wrote: > > This option is not straight forward. There are too many dependencies. > Easier in Linux not so easy in AIX. POWER hardware? It might be easier and quicker to get Linux running on the machine, and figure it out there, than to try it

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Tue, 5 Jul 2016 18:40:51 -0400, Joel Goldstick wrote: >On Tue, Jul 5, 2016 at 6:29 PM, Seymore4Head > wrote: >> On Tue, 5 Jul 2016 18:27:25 -0400, Joel Goldstick >> wrote: >> >>>On Tue, Jul 5, 2016 at 6:05 PM,

Re: Need help compiling Python-devel

2016-07-05 Thread Michael Torrie
On 07/05/2016 10:35 AM, TM wrote: > This option is not straight forward. There are too many dependencies. > Easier in Linux not so easy in AIX. > > Is it possible to copy the python executable (ie the code below)? > # cp -p python python-devel What is this python-devel thing? You said you

Re: Appending an asterisk to the end of each line

2016-07-05 Thread MRAB
On 2016-07-05 23:05, Seymore4Head wrote: import os f_in = open('win.txt', 'r') f_out = open('win_new.txt', 'w') for line in f_in.read().splitlines(): f_out.write(line + " *\n") f_in.close() f_out.close() os.rename('win.txt', 'win_old.txt') os.rename('win_new.txt', 'win.txt') I just

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Joel Goldstick
On Tue, Jul 5, 2016 at 6:29 PM, Seymore4Head wrote: > On Tue, 5 Jul 2016 18:27:25 -0400, Joel Goldstick > wrote: > >>On Tue, Jul 5, 2016 at 6:05 PM, Seymore4Head >> wrote: >>> import os >>> >>> f_in =

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Tue, 5 Jul 2016 18:27:25 -0400, Joel Goldstick wrote: >On Tue, Jul 5, 2016 at 6:05 PM, Seymore4Head > wrote: >> import os >> >> f_in = open('win.txt', 'r') >> f_out = open('win_new.txt', 'w') >> >> for line in f_in.read().splitlines():

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Joel Goldstick
On Tue, Jul 5, 2016 at 6:05 PM, Seymore4Head wrote: > import os > > f_in = open('win.txt', 'r') > f_out = open('win_new.txt', 'w') > > for line in f_in.read().splitlines(): > f_out.write(line + " *\n") > > f_in.close() > f_out.close() > > os.rename('win.txt',

[issue27452] IDLE: Cleanup config code

2016-07-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: $ ./python -m file /home/serhiy/py/cpython/file.py $ ./python file.py file.py -- ___ Python tracker ___

Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
import os f_in = open('win.txt', 'r') f_out = open('win_new.txt', 'w') for line in f_in.read().splitlines(): f_out.write(line + " *\n") f_in.close() f_out.close() os.rename('win.txt', 'win_old.txt') os.rename('win_new.txt', 'win.txt') I just tried to reuse this program that was posted

[issue27452] IDLE: Cleanup config code

2016-07-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: How can you get a relative path in 3.6 (or other current Python)? To test, I wrote file.py containing "print(__file__)". Executing from IDLE, with "python path/to/file.py", "path/to/file.py", "file.py" in the path/to directory, and "python -m to.file" (where

[issue27458] Allow subtypes of unicode/str to hit the optimized unicode_concatenate block

2016-07-05 Thread Ammar Askar
Ammar Askar added the comment: Side note, I was using this script which uses gdb to trace the execution path when it concatenates strings. -- Added file: http://bugs.python.org/file43632/test.py ___ Python tracker

Re: py2exe crashes on simple program

2016-07-05 Thread John Nagle
On 7/4/2016 11:13 PM, Steven D'Aprano wrote: > If you change it to "library.exe" does it work? Also, I consider this > a bug in py2exe: - it's an abuse of assert, using it to check > user-supplied input; - it's a failing assertion, which by definition > is a bug. I'm not trying to build

[issue27019] Reduce marshal stack depth for 2.7 on Windows debug build

2016-07-05 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: -pitrou ___ Python tracker ___ ___ Python-bugs-list

[issue27019] Reduce marshal stack depth for 2.7 on Windows debug build

2016-07-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +benjamin.peterson ___ Python tracker ___

[issue24557] Refactor LibreSSL / EGD detection

2016-07-05 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: -pitrou ___ Python tracker ___ ___ Python-bugs-list

[issue24557] Refactor LibreSSL / EGD detection

2016-07-05 Thread Brett Cannon
Changes by Brett Cannon : -- nosy: -brett.cannon ___ Python tracker ___ ___

[issue24557] Refactor LibreSSL / EGD detection

2016-07-05 Thread Brett Cannon
Brett Cannon added the comment: You could try bringing this up on the security-sig to see if there is enough interest: https://mail.python.org/mailman/listinfo/security-sig -- ___ Python tracker

[issue27452] IDLE: Cleanup config code

2016-07-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If config.py is just executed, __file__ can be a relative path. RemoveFile() looks as a part of public API. If you are sure that nobody needs to remove a config file, you can remove this method. -- ___ Python

[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-07-05 Thread Bernard Spil
Bernard Spil added the comment: Can you please replace the HAVE_RAND_EGD bits with OPENSSL_NO_EGD as defined by both OpenSSL 1.1 and LibreSSL? EGD default disabled https://github.com/openssl/openssl/blob/master/Configure#L363 EGD methods not available

Help: Python socket unit test framework

2016-07-05 Thread Harsh Gupta
Hello All, I have been trying to write a test framework for a pretty simple command server application in python. I have not been able to figure out how to test the socket server. I would really appreciate if you could help me out in testing this application using unittest. Please kindly

Help: Python unit testing

2016-07-05 Thread Harsh Gupta
Hello All, I have been trying to write a test framework for a pretty simple command server application in python. I have not been able to figure out how to test the socket server. I would really appreciate if you could help me out in testing this application using unittest. I'm new to this.

[issue27455] Fix tkinter examples to be PEP8 compliant

2016-07-05 Thread John Hagen
John Hagen added the comment: @Terry The reason for changing the quotes was for consistency, since everywhere else on that page used double quotes. That being said, I don't have a strong preference and will happily revert it if that is the consensus. I'm +0 on the change. I personally use

[issue27458] Allow subtypes of unicode/str to hit the optimized unicode_concatenate block

2016-07-05 Thread Ammar Askar
New submission from Ammar Askar: So currently as far as string concatenation goes. ceval has this nice little branch it can take if both operators are unicode types. However, since this check is an Exact check, it means that subtypes of unicode end up going through the slow code path through:

[issue24557] Refactor LibreSSL / EGD detection

2016-07-05 Thread Bernard Spil
Bernard Spil added the comment: It's been a year since this was created. Can we move this forward? For the OpenSSL 1.1 changes, see https://github.com/openssl/openssl/blob/master/Configure#L363 (egd is disabled in the default configuration) and

[issue27448] Race condition in subprocess.Popen which causes a huge memory leak

2016-07-05 Thread Gregory P. Smith
Gregory P. Smith added the comment: FWIW at this point i'm not willing to "fix" issues in Python 2.7's subprocess module for POSIX platforms as subprocess32 is a superior drop in alternative without the issues. inspecting the 2.7 code, if you are seeing a memory leak and the statements that

[issue24254] Make class definition namespace ordered by default

2016-07-05 Thread Eric Snow
Eric Snow added the comment: Here's an updated patch that matches the accepted PEP. Most notably I've added a tp_deforder slot. This was necessary because subclasses should not inherit their parent's __definition_order__ and the ability to delete cls.__definition_order__ makes this

[issue27455] Fix tkinter examples to be PEP8 compliant

2016-07-05 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- components: +Tkinter ___ Python tracker ___ ___

[issue27455] Fix tkinter examples to be PEP8 compliant

2016-07-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: Except for replacing '' with ""*, I am strongly for this patch. To me, caMelcaSe is ugLy, and should not be encouraged. I disagree that camelCase is standard convention, at least not currently. Tkinter itself does not use it. It does not even use TitleCase

[issue27455] Fix tkinter examples to be PEP8 compliant

2016-07-05 Thread John Hagen
John Hagen added the comment: @Berker, sorry for the incorrect diff format, still new to CPython (and Mercurial) workflow. I've attached the diff in a new format. @SilentGhost I see what you mean that camelCase is used often in tkinter (though many of the examples use lower_camel_case, so it

[issue27455] Fix tkinter examples to be PEP8 compliant

2016-07-05 Thread John Hagen
Changes by John Hagen : Removed file: http://bugs.python.org/file43627/0001-Fix-tkinter-docs-PEP8.patch ___ Python tracker ___

[issue27457] shlex.quote incorrectly quotes ampersants, pipes

2016-07-05 Thread R. David Murray
R. David Murray added the comment: If you use shell=True you can do almost anything you can do in the shell, but making it safe is up to you. We provide shlex.quote to help you with that, but only you can know what parts of the expression need quoting and what don't. It sounds like you might

Re: Need help compiling Python-devel

2016-07-05 Thread TM
This option is not straight forward. There are too many dependencies. Easier in Linux not so easy in AIX. Is it possible to copy the python executable (ie the code below)? # cp -p python python-devel Thanks, Tony On Tue, Jul 5, 2016 at 12:12 PM, Dieter Maurer wrote: >

[issue27457] shlex.quote incorrectly quotes ampersants, pipes

2016-07-05 Thread klo uo
klo uo added the comment: So there is no reliable way for converting chained command line sequence to string on *nix, when I have to to use string as shell=True? -- ___ Python tracker

Re: Two curious errors when function globals are manipulated

2016-07-05 Thread eryk sun
On Tue, Jul 5, 2016 at 4:12 PM, Random832 wrote: > So any special logic in your own __setitem__, which may have > included e.g. copying it to an alternate place, changing the key or > value, or simply refusing to add the item to the dictionary at all, will > be ignored,

[issue27456] TCP_NODELAY

2016-07-05 Thread Yury Selivanov
Yury Selivanov added the comment: > Is there a similar update that can be made to uvloop? Yes. Once it's committed to asyncio, I'll add it to uvloop immediately. That's one benefit of using uvloop -- it gets updates faster ;) -- ___ Python

[issue27456] TCP_NODELAY

2016-07-05 Thread Jim Fulton
Jim Fulton added the comment: Yury, I'd be fine with you making a PR. :) Is there a similar update that can be made to uvloop? -- ___ Python tracker ___

[issue27456] TCP_NODELAY

2016-07-05 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___

[issue27456] TCP_NODELAY

2016-07-05 Thread Yury Selivanov
Yury Selivanov added the comment: Jim, I can make a PR, unless you want to do that. -- ___ Python tracker ___

[issue27456] TCP_NODELAY

2016-07-05 Thread Jim Fulton
Jim Fulton added the comment: I forgot to switch to the asyncio branch of ZEO when testing on the Amazon/RedHat linux. When I do, the tests run slow there too. Asyncio is dog slow on every linux I've tried. -- ___ Python tracker

[issue27456] TCP_NODELAY

2016-07-05 Thread Guido van Rossum
Guido van Rossum added the comment: Fine with me -- I have no idea what this flag does (nor the desire to learn :-). -- ___ Python tracker ___

Re: How well do you know Python?

2016-07-05 Thread Carl Meyer
On 07/05/2016 05:50 AM, Chris Angelico wrote: > On Tue, Jul 5, 2016 at 9:33 PM, Peter Otten <__pete...@web.de> wrote: >> Chris Angelico wrote: >> >>> On Tue, Jul 5, 2016 at 6:36 PM, Peter Otten <__pete...@web.de> wrote: What will $ cat foo.py import foo class A: pass

[issue27456] TCP_NODELAY

2016-07-05 Thread Yury Selivanov
Yury Selivanov added the comment: See also https://github.com/python/asyncio/issues/286 I also wanted to raise this question. I think transports should set NODELAY by default (as Golang, for instance). I've been hit by this thing a few times already -- performance of protocols over TCP is

Re: Two curious errors when function globals are manipulated

2016-07-05 Thread eryk sun
On Tue, Jul 5, 2016 at 3:50 PM, Steven D'Aprano wrote: > It works with exec: > > py> from collections import ChainMap > py> class ChainDict(ChainMap, dict): > ... pass > ... > py> m = ChainDict() > py> exec("x = 1", m, m) > py> m['x'] > 1 > > (Tested in both 3.3 and 3.6.)

Re: Two curious errors when function globals are manipulated

2016-07-05 Thread Random832
On Tue, Jul 5, 2016, at 11:50, Steven D'Aprano wrote: > If PyDict_SetItem expects an actual dict (accept no substitutes or > subclasses), why is there no error? I would have expected a segfault at > worst or at least an exception. Subclasses are fine. Sort of. In general if you pass a *subclass*

[issue27457] shlex.quote incorrectly quotes ampersants, pipes

2016-07-05 Thread R. David Murray
R. David Murray added the comment: Yes, the point of shlex.quote is to get something that is *not* special to the shell, and therefore safe to pass to the shell. If you *want* an & in your command, just pass it, don't quote it. quote is for *untrusted* data, like filenames received from a

[issue27442] expose the Android API level in sysconfig.get_config_vars()

2016-07-05 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: Yep adding Python to Android's build system is a rare case. Just to mention there's already an macro and avoiding possible redefined macros is always good. -- ___ Python tracker

[issue27442] expose the Android API level in sysconfig.get_config_vars()

2016-07-05 Thread Xavier de Gaye
Xavier de Gaye added the comment: Integrating Python into AOSP does not make sense. The patch can be changed with s/ANDROID_API/ANDROID_API_LEVEL. -- ___ Python tracker

[issue27457] shlex.quote incorrectly quotes ampersants, pipes

2016-07-05 Thread Xiang Zhang
Xiang Zhang added the comment: Doesn't this the expected behaviour of shlex.quote, return a shell-escaped version of the string s? If && is not quoted, how about "pwd && rm -rf ~"? I think in your case there is no need to use shlex.quote. -- nosy: +xiang.zhang

Re: Two curious errors when function globals are manipulated

2016-07-05 Thread eryk sun
On Tue, Jul 5, 2016 at 3:37 PM, eryk sun wrote: > In CPython 3.6, LOAD_GLOBAL does fall back on PyObject_GetItem I did some digging to find when this changed in 3.3: https://hg.python.org/cpython/diff/e3ab8aa0216c/Python/ceval.c Notice in the last comment on issue 14385 that

[issue27456] TCP_NODELAY

2016-07-05 Thread Jim Fulton
Jim Fulton added the comment: Gaaa, forgot to set meta data. -- components: +asyncio nosy: +gvanrossum, haypo, yselivanov type: -> performance versions: +Python 3.4, Python 3.5 ___ Python tracker

Re: Two curious errors when function globals are manipulated

2016-07-05 Thread Steven D'Aprano
On Wed, 6 Jul 2016 01:27 am, eryk sun wrote: > On Tue, Jul 5, 2016 at 2:46 PM, Steven D'Aprano > wrote: >> I've come across two curious behaviours of a function using custom >> globals. In both cases, I have a function where __globals__ is set to a >> ChainMap. > > ChainMap

[issue27442] expose the Android API level in sysconfig.get_config_vars()

2016-07-05 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: Here's an issue - there's already a macro called ANDROID_API defined in libcutils [1] If someone is going to integrate Python into AOSP, redefining macros may cause a problem. [1]

[issue27457] shlex.quote incorrectly quotes ampersants, pipes

2016-07-05 Thread klo uo
New submission from klo uo: Example code: Python 3.4.3 (default, Oct 14 2015, 20:28:29) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import shlex >>> cmd = ["pwd", "&&", "ls"] >>> '

Re: Two curious errors when function globals are manipulated

2016-07-05 Thread eryk sun
On Tue, Jul 5, 2016 at 3:27 PM, eryk sun wrote: > ChainMap implements the MutableMapping abstract base class. But > CPython needs globals to be a dict. In the current implementation, > LOAD_GLOBAL calls _PyDict_LoadGlobal, and STORE_GLOBAL calls > PyDict_SetItem. They don't

Re: Making Classes Subclassable

2016-07-05 Thread Steven D'Aprano
On Wed, 6 Jul 2016 01:02 am, Ian Kelly wrote: > On Mon, Jul 4, 2016 at 2:34 AM, Lawrence D’Oliveiro > wrote: >> On Monday, July 4, 2016 at 7:58:07 PM UTC+12, dieter wrote: >>> --> "type(obj)" or "obj.__class__" (there are small differences) >>> give you the type/class of

Re: Making Classes Subclassable

2016-07-05 Thread Steven D'Aprano
On Wed, 6 Jul 2016 12:41 am, Ian Kelly wrote: > On Tue, Jul 5, 2016 at 2:31 AM, Steven D'Aprano > wrote: >> On Monday 04 July 2016 18:34, Lawrence D’Oliveiro wrote: >> >>> On Monday, July 4, 2016 at 7:58:07 PM UTC+12, dieter wrote: --> "type(obj)" or

[issue27442] expose the Android API level in sysconfig.get_config_vars()

2016-07-05 Thread Xavier de Gaye
Xavier de Gaye added the comment: According to issue 27453, do this minor change in the patch: s/$CC -E/$CPP $CPPFLAGS. -- ___ Python tracker ___

[issue27453] Fix cross-compilation with Android NDK and Clang

2016-07-05 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: Several days ago I have once tried to set CC="clang -target $(TARGET) -gcc-toolchain $(GCC_TOOLCHAIN)", and it failed to build some dependency of Python (I can't remember). Just tried and everything is OK. Dunno what's changed. Anyway both approaches (-target

Re: Two curious errors when function globals are manipulated

2016-07-05 Thread eryk sun
On Tue, Jul 5, 2016 at 2:46 PM, Steven D'Aprano wrote: > I've come across two curious behaviours of a function using custom globals. > In both cases, I have a function where __globals__ is set to a ChainMap. ChainMap implements the MutableMapping abstract base class. But

[issue27456] TCP_NODELAY

2016-07-05 Thread Jim Fulton
New submission from Jim Fulton: tl;dr TCP_NODELAY should be set by default and/or there should be a proper way to set it. I've ported ZEO, ZODB's client-server networking layer to asyncio. Things were going pretty well. I've been developing on a Mac. Yesterday, I ran some performance

[issue26826] Expose new copy_file_range() syscall in os module.

2016-07-05 Thread Facundo Batista
Facundo Batista added the comment: It looked ok to me (I couldn't try it, as I still have 4.4 kernel). One thing to the be done is to improve the test coverage (trying the usage of all the parameters, at least). -- nosy: +facundobatista ___ Python

Re: Making Classes Subclassable

2016-07-05 Thread Ian Kelly
On Mon, Jul 4, 2016 at 2:34 AM, Lawrence D’Oliveiro wrote: > On Monday, July 4, 2016 at 7:58:07 PM UTC+12, dieter wrote: >> --> "type(obj)" or "obj.__class__" (there are small differences) >> give you the type/class of "obj". > > When would it not be the same? I think the

[issue27453] Fix cross-compilation with Android NDK and Clang

2016-07-05 Thread Xavier de Gaye
Xavier de Gaye added the comment: With configure run as './configure CC="$(CC)" ...' and when CC is set to: CC = clang --sysroot=$(SYSROOT) -target $(TARGET) -gcc-toolchain $(GCC_TOOLCHAIN) and building for armv7 on android-21, then configure runs $CPP as: checking for CPP... clang

Re: Making Classes Subclassable

2016-07-05 Thread Ian Kelly
On Mon, Jul 4, 2016 at 1:57 AM, dieter wrote: > Lawrence D’Oliveiro writes: > >> Some of the classes in Qahirah, my Cairo binding >> I found handy to reuse elsewhere, for >> example in my binding for Pixman

Two curious errors when function globals are manipulated

2016-07-05 Thread Steven D'Aprano
I've come across two curious behaviours of a function using custom globals. In both cases, I have a function where __globals__ is set to a ChainMap. In the first, the builtin __import__ appears to both exist and not-exist at the same time: I can see the __import__ builtin, but the `import`

Re: Making Classes Subclassable

2016-07-05 Thread Ian Kelly
On Tue, Jul 5, 2016 at 2:31 AM, Steven D'Aprano wrote: > On Monday 04 July 2016 18:34, Lawrence D’Oliveiro wrote: > >> On Monday, July 4, 2016 at 7:58:07 PM UTC+12, dieter wrote: >>> --> "type(obj)" or "obj.__class__" (there are small differences) >>> give

[issue27454] PyUnicode_InternInPlace can use PyDict_SetDefault

2016-07-05 Thread Berker Peksag
Berker Peksag added the comment: I think you also need to update the comment below: /* It might be that the GetItem call fails even though the key is present in the dictionary, namely when this happens during a stack overflow. */ -- nosy: +berker.peksag, haypo,

  1   2   >