[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 tests to cpython only and added the assertion to 
ensure they are not interned. I don't think there's any language level features 
to ensure strings are not interned.

As far as testing the execution path goes. I was updating the source code in my 
test.py script between concatenating with subtypes vs just plain old unicode 
objects since doing multiple traces was starting to get a lot more complicated 
with gdb scripting :)

--
Added file: http://bugs.python.org/file43635/python.diff

___
Python tracker 

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



[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 

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



[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 

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



[issue24557] Refactor LibreSSL / EGD detection

2016-07-05 Thread Larry Hastings

Changes by Larry Hastings :


--
nosy:  -larry

___
Python tracker 

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



[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 

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



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

F:\Python\dev\36\Lib\idlelib>..\..\pcbuild\win32\python_d.exe config.py

 {'keys': <__main__.IdleConfParser object at 0x02633B200080>,
  ... 

At one time, I thought, sys.path[0] was '', representing the current directory, 
and not the absolute path of the starting directory.  I am not sure if there 
are any cross platform, cross implementation, guarantees. 

There are 12 other idlelib files using __file__.  I ran each in either idlelib 
or idle_test as appropriate.  11 run. test_help.py fails at this line (which I 
wrote)
  helpfile = join(abspath(dirname(dirname(__file__))), 'help.html')
as the double dirname does not have the expected effect. A version of the 
conditional from config, with dirname(sys.path[0]), would work.  However, 
taking the abspath first is easier.
  helpfile = join(dirname(dirname(abspath(__file__))), 'help.html')

The comment in config appears to refer to the exec command/function.  I don't 
know what either does with __name__, __file__, or sys.path.

---
With the two IdleConf dict keys sorted, the first patch results in consistent 
output.  configparser.ConfigParser uses OrderedDicts by default, so re-running 
on unchanged files results in unchanged iteration order.

--

___
Python tracker 

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



[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 

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



[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 

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



[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. The right operand is a unicode type
 3. The left operand's __add__ method isn't overriden */


I don't think that's sufficient. You also need to check the right operand's 
__radd__ method if it is a subclass of the left:

class A(str):
pass

class B(str):
def __radd__(self, other):
return B(other.uppper() + str(self))

a = A("hello ")
b = B("world")
assert a + b == "HELLO world"



Also you have some tests, but I don't think they're sufficient. You have a 
comment about "Longer strings to prevent interning" but I'm not sure that a 
mere 21 characters is guaranteed now and forever to do that. I'd be much 
happier to see a long string which is not an identifier:

s = S("# ! ~"*50)  # hopefully will not be interned

plus an assertion to check that it is not interned. That way, if the rules for 
interning ever change, the test will fail loudly and clearly rather than 
silently do the wrong thing.

(Better still would be an actual language API for un-interning strings, if one 
exists.)

Also, I see that you have tests to check that the optimized path is taken for 
subclasses, but do you have tests to check that it is NOT taken when it 
shouldn't be?

--
nosy: +steven.daprano
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



[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 is more work for you, less useful for us, and 
makes it impossible for the blind and visually impaired to read it using a 
screen-reader.

--
nosy: +steven.daprano

___
Python tracker 

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



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



[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 line counter and crc to IDLE configHandler test dump.
https://hg.python.org/cpython/rev/127569004538

New changeset c2e21bc83066 by Terry Jan Reedy in branch 'default':
Issue #27452: add line counter and crc to IDLE config test dump.
https://hg.python.org/cpython/rev/c2e21bc83066

--
nosy: +python-dev

___
Python tracker 

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



[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: normal
status: open
title: unintended changes occurs when dealing with list of list
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file43633/Screenshot from 2016-07-05 
16-44-14.png

___
Python tracker 

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



[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 

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



[issue27456] TCP_NODELAY

2016-07-05 Thread Yury Selivanov

Yury Selivanov added the comment:

PR: https://github.com/python/asyncio/pull/373

--

___
Python tracker 

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



[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 

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



[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 path is on sys.path) all resulted in the absolute 
path.  After adding "input()" to suspend execution, double clicking in Explorer 
gives the same result.  Have I forgotten something? Do any of these result is 
something different on Linux? (or Mac?, for that matter)

The only reason to execute rather than import config.py is to run the test at 
the end of the file after editing the file.  In the absence of a thorough 
automated test, I occasionally do so.

The approximately 500 lines of output is too much to read in detail (although 
one might check one specific part), but that it runs and produces the same 
number of lines before and after a change is reassuring. I should add a line 
counter and checksum to the dump function.

As for removing RemoveFile: idlelib in 3.6 is, with a few exceptions, a private 
API.

--

___
Python tracker 

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



[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 

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



[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 mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

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



[issue24557] Refactor LibreSSL / EGD detection

2016-07-05 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy:  -pitrou

___
Python tracker 

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



[issue24557] Refactor LibreSSL / EGD detection

2016-07-05 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[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 

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



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

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



[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 
https://github.com/openssl/openssl/blob/master/include/openssl/rand.h#L61

--

___
Python tracker 

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



[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 single quotes everywhere and use flake8-quotes to help with 
this.

--

___
Python tracker 

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



[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: PyNumber_Add -> PyUnicode_Concat.

This patch aims to allow subtypes to take that optimized branch without 
breaking any existing behavior and without any more memory copy calls than 
necessary.

The motivation for this change is that some templating engines 
(Mako/Jinja2/Cheetah) use stuff like MarkupSafe which is implemented with a 
unicode subtype called `Markup`. Concatenating these custom objects (pretty 
common for templating engines) is fairly slow. This change modifies and uses 
the existing cpython code to make it a fair bit faster.

I think the only real "dangerous" change in here is in the 
cast_unicode_subtype_to_base function which uses a trick at the end to prevent 
deallocation of memory. I've made sure to keep it well commented but I'd 
appreciate any feedback on it.

>From what I can tell from running the test suite, all tests pass and there 
>don't seem to be any new reference leaks.

--
components: Interpreter Core
files: python.diff
keywords: patch
messages: 269849
nosy: ammar2, benjamin.peterson, ezio.melotti, haypo, lemburg, pitrou
priority: normal
severity: normal
status: open
title: Allow subtypes of unicode/str to hit the optimized unicode_concatenate 
block
type: performance
Added file: http://bugs.python.org/file43631/python.diff

___
Python tracker 

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



[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
https://github.com/openssl/openssl/blob/master/include/openssl/rand.h#L61
When OPENSSL_NO_EGD is defined, the EGD related methods are rempved.

This is still causing build problems on some isntallations, seems there can be 
diffences in detection between configure and build phase.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205960#

--

___
Python tracker 

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



[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 fail before the gc.enable call are more than "self._child_created = True" 
and "if self.pid == 0:", it must be the child process.

there DOES appear to be a unlikely but potential bug in the 2.7 child process 
code: its "os._exit(255)" call should really be within a finally: so that any 
exception raised during the bare "except:" phase somehow still exits.  that 
should be rare.  the result if missing that would be a runaway forked child 
process that does indeed have gc disabled but is in the process of propagating 
an exception upwards (and is likely to hit others along the way in the other 
finally: clauses) so it is would die anyways unless the calling code catches 
and dismisses that (possible).

so what I _imagine_ you _might_ be seeing somehow is the pre-exec forked child 
exception handling+reporting code failing and leading to a runaway child who's 
exception you caught and let keep running.  if you have this situation, 
something else odd is going on (is the os.write() failing?).

i've attached a _possible_ patch.  but i'd rather not commit this without a 
test that reproduces the situation (that sounds difficult).

I strongly recommend you just use subprocess32.

--
keywords: +patch
nosy: +gregory.p.smith
Added file: http://bugs.python.org/file43630/issue27448-gps01.patch

___
Python tracker 

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



[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 problematic.  I didn't see a way to do that 
without adding a new type slot.

--
Added file: http://bugs.python.org/file43629/deforder-with-tp-slot.diff

___
Python tracker 

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



[issue27455] Fix tkinter examples to be PEP8 compliant

2016-07-05 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
components: +Tkinter

___
Python tracker 

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



[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 much.

As near as I could find, neither 
http://effbot.org/tkinterbook/tkinter-index.htm nor 
http://www.tkdocs.com/tutorial/index.html introduce camelCase identifiers.  For 
instance, http://effbot.org/tkinterbook/tkinter-hello-again.htm, instead of 
hiThere and sayHi, has

self.hi_there = Button(frame, text="Hello", command=self.say_hi)
 def say_hi(self):
 
* PEP 8 says "In Python, single-quoted strings and double-quoted strings are 
the same. This PEP does not make a recommendation for this." My personal 
convention is 'word', which occurs a lot in tkinter code, and 'multi-word 
phrase or sentence", which is much rarer.  Why the change in the patch.

--

___
Python tracker 

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



[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 seems like at least 
it's not consistent currently).

The minor issue I was trying to fix with this patch is that I was showing a 
programmer completely new to Python the tkinter example and when he pasted it 
into PyCharm it had some PEP8 warnings, so I was hoping to improve that 
experience slightly for others in the future.  Some of the changes were 
newlines for PEP8, would those be accepted?  I'm not strongly inclined either 
way, so if the core team thinks it should not be changed, I'm happy with that.

--
Added file: http://bugs.python.org/file43628/0001-Fix-tkinter-docs-PEP8.diff

___
Python tracker 

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



[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 

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



[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 find the stdlib 'pipes' module interesting.

--

___
Python tracker 

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



[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 

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



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

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



[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 

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



[issue27456] TCP_NODELAY

2016-07-05 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[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 

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



[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 

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



[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 

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



[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 terrible because somebody 
forgot to set this flag.

--

___
Python tracker 

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



[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 user.

Or better, don't use shell=True all.

(list2cmdline has a different purpose, unique to windows)

--
nosy: +r.david.murray
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



[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 

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



[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 

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



[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

___
Python tracker 

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



[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 

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



[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] 
https://android.googlesource.com/platform/system/core/+/master/include/cutils/compiler.h#42

--

___
Python tracker 

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



[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"]
>>> ' '.join(shlex.quote(arg) for arg in cmd)
"pwd '&&' ls"
>>>


Double ampersants is quoted, and if this command string is passed to Popen or 
pasted in shell it would fail.


OTOH, Windows so-so compatible list2cmdline:


Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> cmd = ["cd", "&&", "dir"]
>>> subprocess.list2cmdline(cmd)
'cd && dir'
>>>


behaves correctly.

--
messages: 269830
nosy: klo.uo
priority: normal
severity: normal
status: open
title: shlex.quote incorrectly quotes ampersants, pipes
type: behavior
versions: Python 3.4

___
Python tracker 

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



[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 

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



[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 in $CC/$CXX/$CPP 
and -target in $CFLAGS/$CXXFLAGS/$CPPFLAGS) should be supported.

--

___
Python tracker 

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



[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 measurements on Linux and found
some tests ran 30x slower.

After some digging, I came across this:

https://github.com/python/asyncio/issues/311

Then led me to try setting TCP_NODELAY, which provided Linux
performance comparable to Mac OS performance.

Issue 311 suggested that this was a kernal-version issue.  I think
this is a failure to set, or at least provide a way to set a "don't be
stupid" option.

I originally tried this on Ubuntu 14.04, with kernal
3.13.0-74-generic.  I then tried Ubuntu 16.04, in a docker image, with
kernal 4.4.12-boot2docker. For both of these, performance for the
write tests were 30x slower unless I set TCP_NODELAY.

Finally, I tried an Amazon standard AMI, which runs some version of
RedHat, with kernal 4.4.11-23.53.amzn1.x86_64.  On that system,
performance of the tests was similar to Mac OS X without setting
TCP_NODELAY.

Note that the non-slow kernal version was lower than the slow (Ubuntu)
one. I don't think this is mearly a kernal version issue, nor do I
think this should have been dismissed as one.

I couldn't find a way to set TCP_NODELAY cleanly. Did I miss something?
https://github.com/python/asyncio/issues/286 suggests there isn't one.

I ended up having to set the option on _sock transport attributes,
which is dirty and, I assume, won't work with uvloop. (BTW, uvloop was
only ~15x slower on linux systems with this problem.)

I think TCP_NODELAY should be set by default.  Perhaps it shouldn't be
set on mobile, by everywhere else, I think it's a "don't be stupid"
option.

I also think there should be a way to set it cleanly.

IMO, this is extremely important. Linux is a wildly important platform
for networking applications and Python, and, for better or worse,
Ubuntu is a very commonly used distribution.  Having asyncio, perform
so poorly on these platforms is a big deal.

--
messages: 269826
nosy: j1m
priority: normal
severity: normal
status: open
title: TCP_NODELAY

___
Python tracker 

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



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

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



[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 
--sysroot=/opt/android-ndk/platforms/android-21/arch-arm -target 
armv7-none-linux-androideabi -gcc-toolchain 
/opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -E

as can be seen by inserting in configure.ac:
AC_MSG_CHECKING([for CPP])
AC_MSG_RESULT([$CPP])

and the shared libraries are named 
'module_name.cpython-36m-arm-linux-gnueabi.so'.

OTOH, the 'configure' script runs its own preprocessings with the following 
idiom:
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; 
then :

where 'ac_cpp' is set to ac_cpp='$CPP $CPPFLAGS'.
So the proposed patch LGTM.

PLATFORM_TRIPLETs are specific to multiarch systems such as debian and should 
not be relied upon on Android, but they should not be entirely wrong of course.

--
nosy: +doko

___
Python tracker 

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



[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, serhiy.storchaka
stage:  -> patch review

___
Python tracker 

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



[issue17128] OS X system openssl deprecated - installer should build local libssl

2016-07-05 Thread Brian Curtin

Changes by Brian Curtin :


--
nosy:  -brian.curtin

___
Python tracker 

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



[issue27455] Fix tkinter examples to be PEP8 compliant

2016-07-05 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the patch. If you want to improve the examples in tkinter 
documentation, I'd suggest to update Class.__init__(self, ...) to 
super().__init__(...). There is no old-style classes in Python 3 anymore so 
those examples could be updated safely.

Also, please read https://docs.python.org/devguide/patch.html. Sending a patch 
from a Git checkout will only make the review process harder (and I will 
personally ignore them in the future).

--
nosy: +berker.peksag, terry.reedy
stage:  -> patch review
type:  -> enhancement

___
Python tracker 

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



[issue27441] redundant assignments to ob_size of new ints that _PyLong_New returned

2016-07-05 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +haypo, serhiy.storchaka
stage:  -> commit review
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



[issue27455] Fix tkinter examples to be PEP8 compliant

2016-07-05 Thread SilentGhost

SilentGhost added the comment:

This patch is going to be rejected, camelCase is standard convention in tkinter 
and logging modules and that's why it is used in documentation as well.

--
nosy: +SilentGhost

___
Python tracker 

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



[issue27455] Fix tkinter examples to be PEP8 compliant

2016-07-05 Thread John Hagen

New submission from John Hagen:

Patch fixes tkinter examples to be PEP8 compliant.

--
assignee: docs@python
components: Documentation
files: 0001-Fix-tkinter-docs-PEP8.patch
keywords: patch
messages: 269820
nosy: John Hagen, docs@python
priority: normal
severity: normal
status: open
title: Fix tkinter examples to be PEP8 compliant
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43627/0001-Fix-tkinter-docs-PEP8.patch

___
Python tracker 

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



[issue27454] PyUnicode_InternInPlace can use PyDict_SetDefault

2016-07-05 Thread INADA Naoki

New submission from INADA Naoki:

PyDict_SetDefault() was added Python 3.4

Currently, PyUnicode_InternInPlace() uses PyDict_GetItem, and PyDict_SetItem if 
no item found.
It can be replaced PyDict_SetDefault() easily.

--
components: Interpreter Core
files: intern-setdefault.patch
keywords: patch
messages: 269819
nosy: naoki
priority: normal
severity: normal
status: open
title: PyUnicode_InternInPlace can use PyDict_SetDefault
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file43626/intern-setdefault.patch

___
Python tracker 

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



[issue27450] bz2: BZ2File should expose compression level as an attribute

2016-07-05 Thread R. David Murray

R. David Murray added the comment:

New features can only be added in a new feature release, which means 3.6 at the 
moment (the window for that is shrinking fast, though, we hit beta in 
September).

--
nosy: +r.david.murray
stage:  -> needs patch
versions:  -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



[issue27422] Deadlock when mixing threading and multiprocessing

2016-07-05 Thread R. David Murray

R. David Murray added the comment:

Heh, yeah.  What I was really trying to do by that comment was clarify for any 
*other* readers that stumble on this issue later it is just the python code 
that *has* to be constrained by the GIL.  I have no idea how much of the scipy 
stack drops the gil at strategic spots.  I do seem to remember that the the 
Jupyter uses multiple processes for its parallelism, though.  Anyway, this is 
pretty off topic now :)

--

___
Python tracker 

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



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

2016-07-05 Thread Chi Hsuan Yen

New submission from Chi Hsuan Yen:

Motivation: Android NDK is deprecating GCC and moving ot Clang/LLVM. From [1]:

We strongly recommend switching to Clang.
GCC in the NDK is now deprecated in favor of Clang.

This patch fixes the only one problem when migrating GCC to Clang.

In my build script, $CPP is set to 
"${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -E" and 
$CPPFLAGS is set to "-target armv7-none-linux-androideabi -gcc-toolchain 
${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 
--sysroot ${ANDROID_NDK}/platforms/android-21/arch-arm/usr -I${PREFIX}/include 
-DANDROID". I'm not sure whether it's the correct usage of clang, but at least 
it works.

With such a configuration, most Python parts builds well. Just something wrong 
- extensions as built as xyz.cpython-36m-x86_64-linux-gnu.so. My patch just 
fixes $(PLATFORM_TRIPLET) detection.

[1] https://developer.android.com/ndk/downloads/revision_history.html

--
components: Cross-Build
files: ndk-clang-preprocessor.patch
keywords: patch
messages: 269816
nosy: Alex.Willmer, Chi Hsuan Yen, xdegaye
priority: normal
severity: normal
status: open
title: Fix cross-compilation with Android NDK and Clang
type: compile error
versions: Python 3.6
Added file: http://bugs.python.org/file43625/ndk-clang-preprocessor.patch

___
Python tracker 

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



[issue27444] Python doesn't build due to test_float.py broken on non-IEEE machines

2016-07-05 Thread Mark Dickinson

Mark Dickinson added the comment:

[David]

> maybe Mark will be interested, but he probably doesn't have time either.  
> Also, he's been known to say he'd like to drop support for non-IEEE 
> architectures ;)

Exactly correct on all counts. :-) I'm *very* interested: I've been looking for 
a non-IEEE machine to play with Python on for years. But time is (as ever) in 
short supply.

Realistically, maintaining support for non-IEEE 754 platforms looks like 
something with an enormously high cost/benefit ratio; maintaining just on 
machines with (some approximation of) IEEE 754 is already enough work.

Greg: you say "there are other non-ieee platforms out there". Can you point me 
to any current hardware using non-IEEE 754 floating-point formats that one 
might want to run Python on? I know there are examples where not all of the 
IEEE 754 standard is supported, but the interchange format used is still IEEE 
754 binary64 / binary32 / whatever, but that's not what I'm looking for; I'm 
looking for cases where the underlying format is different. The only example 
I'm aware of is the IBM System z, with its hexadecimal floating-point format, 
but those machines support IEEE 754 too.

--

___
Python tracker 

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



[issue27254] UAF in Tkinter module

2016-07-05 Thread Emin Ghuliev

Changes by Emin Ghuliev :


--
status: open -> closed

___
Python tracker 

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



[issue27254] UAF in Tkinter module

2016-07-05 Thread Emin Ghuliev

Changes by Emin Ghuliev :


--
resolution:  -> third party

___
Python tracker 

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