[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args

2013-11-28 Thread paul j3

paul j3 added the comment:

`parse_args` just calls `parse_known_args`, and then raises an error if `rest` 
is not empty.  So it is `parse_known_args` that is doing the abbreviation 
matching.  

Abbreviation matching is done relatively early, when `_parse_known_args` first 
loops through the strings, trying to decide which are arguments ('A') and which 
are options ('O').  This matching is done  in `_parse_optional`.  It's not 
something it does at the end on the 'leftovers'.

http://bugs.python.org/issue14910, a disable abbreviation option, might be a 
better solution.  Your example is an argument in favor of implementing that 
feature.

Unless a reader has your example in mind, the proposed documentation warning 
might be more confusing than helpful.

--
nosy: +paul.j3

___
Python tracker 

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



[issue19702] Update pickle to PEP 451

2013-11-28 Thread Nick Coghlan

Nick Coghlan added the comment:

The specific proposal was to use __spec__.name when __name__ == "__main__"
to avoid the pickle compatibility issues described in PEP 395 when using
the -m switch.

runpy has to be updated first, though.

--

___
Python tracker 

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



[issue13655] Python SSL stack doesn't have a default CA Store

2013-11-28 Thread Dima Tisnek

Dima Tisnek added the comment:

re: cert_paths = [...]

This approach is rather problematic, there's no guarantee that a path trusted 
on one system is trusted on another.

I saw this in setuptools branch, where it does:

for path in cert_path:
if os.path.exists(path)
return path

Let's say you're user1 on osx and your native true path is 
"/System/Library/OpenSSL/certs/cert.pem", can you guarantee that someone else, 
user2, cannot sneak their hacked files into "/etc/pki/" (presumably missing 
altogether) or "/usr/local/share/"?

Because if user2 can do that, suddenly user1 verifies all traffic against 
hacked ca list.

--
nosy: +Dima.Tisnek

___
Python tracker 

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




[issue15495] enable type truncation warnings for gcc builds

2013-11-28 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue13655] Python SSL stack doesn't have a default CA Store

2013-11-28 Thread Christian Heimes

Christian Heimes added the comment:

All these paths are on directories that are supposed to be read-only for 
untrusted users. You can't protect yourself against a malicious admin anyway. 
For Python 3.4 the ssl module uses the cert path that are configured with 
OpenSSL. The paths and configuration are outside our control.

--

___
Python tracker 

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



[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args

2013-11-28 Thread Eli Bendersky

Eli Bendersky added the comment:

I don't see how these implementation details are relevant. The patch adds a 
link to the existing abbreviations section, which mentions parse_args - so it's 
clear that this behavior exists in both.

Yes, #14910 (to which I pointed in the original message in this issue) is the 
long term solution, but it's only for Python 3.5; until then, as the mailing 
discussion has demonstrated, the documentation is unclear on this matter and 
needs clarification.

--

___
Python tracker 

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



[issue19822] PEP process entrypoint

2013-11-28 Thread anatoly techtonik

New submission from anatoly techtonik:

https://bitbucket.org/rirror/peps

PEP repository readme lacks information about how to send Python Enhancement 
Proposal step-by-step.

1. hg clone https://bitbucket.org/rirror/peps
2. cd peps
3. # choose number
4. cp ??? pep-{{number}}.txt
5. # commit
6. # send pull request
7. # discuss

--
assignee: docs@python
components: Devguide, Documentation
messages: 204652
nosy: docs@python, ezio.melotti, techtonik
priority: normal
severity: normal
status: open
title: PEP process entrypoint

___
Python tracker 

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



[issue19823] for-each on list aborts earlier than expected

2013-11-28 Thread cost6

New submission from cost6:

for-each does not iterate over all entries of collection, if one removes 
elements during the iteration.

Example (misbehaving) code:

def keepByValue(self, key=None, value=[]):
for row in self.flows:
if not row[key] in value:
flows.remove(row)

--
components: Interpreter Core
messages: 204653
nosy: cost6
priority: normal
severity: normal
status: open
title: for-each on list aborts earlier than expected
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue19822] PEP process entrypoint

2013-11-28 Thread Christian Heimes

Christian Heimes added the comment:

The process is well explained in the PEP templates right at the top of the PEP 
list:

http://www.python.org/dev/peps/pep-0009/
http://www.python.org/dev/peps/pep-0012/

New PEP authors should get in touch with experienced core developers or mentors 
in order to get assistance.

--
nosy: +christian.heimes
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue19822] PEP process entrypoint

2013-11-28 Thread STINNER Victor

STINNER Victor added the comment:

> PEP process entrypoint

Do you work with developers of the distutils-* objects? It looks like Daniel 
Holth works on such PEP for example:
https://mail.python.org/pipermail/distutils-sig/2013-July/021854.html

You may join this mailing list:
https://mail.python.org/mailman/listinfo/distutils-sig

--
nosy: +haypo

___
Python tracker 

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



[issue19815] ElementTree segmentation fault in expat_start_ns_handler

2013-11-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 395a266bcb5a by Eli Bendersky in branch '2.7':
Issue #19815: Fix segfault when parsing empty namespace declaration.
http://hg.python.org/cpython/rev/395a266bcb5a

--
nosy: +python-dev

___
Python tracker 

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



[issue19819] reversing a Unicode ligature doesn't work

2013-11-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
components: +Unicode
nosy: +ezio.melotti
stage: needs patch -> committed/rejected

___
Python tracker 

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



[issue19822] PEP process entrypoint

2013-11-28 Thread anatoly techtonik

anatoly techtonik added the comment:

The "entrypoint" here means the point of entry for new Python Enhancement 
Proposals. Christian, what you propose is a 4th order link for someone who 
knows what PEPs are, and clones PEP repository to submit own proposal.

What I propose it to make PEP repository self-sufficient, so that person who 
cloned it, can immediately get to work. You can argue that people who don't 
have time to read on all previous stuff, should not write PEPs, but I'd object 
that it is good to be inclusive.

--
resolution: invalid -> 
status: closed -> pending

___
Python tracker 

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



[issue19822] PEP process entrypoint

2013-11-28 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Anatoly, please read http://www.python.org/dev/peps/pep-0012/

The process you are describing is not correct. In particular, the discussion 
happens before sending in a pull request.

As for discussion of the PEP process: that should happen on python-dev, not in 
some ticket in the tracker.

Closing the ticket again.

--
nosy: +lemburg
resolution:  -> invalid
status: pending -> closed

___
Python tracker 

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Calling it _PyThread_set_key_value is prone to confusion.
Ideally we would fix PyThread_set_key_value's behaviour. Are there users of the 
function outside from CPython?

--

___
Python tracker 

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



[issue19815] ElementTree segmentation fault in expat_start_ns_handler

2013-11-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 68f1e5262a7a by Eli Bendersky in branch '3.3':
Issue #19815: Fix segfault when parsing empty namespace declaration.
http://hg.python.org/cpython/rev/68f1e5262a7a

New changeset 2b2925c08a6c by Eli Bendersky in branch 'default':
Issue #19815: Fix segfault when parsing empty namespace declaration.
http://hg.python.org/cpython/rev/2b2925c08a6c

--

___
Python tracker 

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



[issue19815] ElementTree segmentation fault in expat_start_ns_handler

2013-11-28 Thread Eli Bendersky

Eli Bendersky added the comment:

Thanks for the report & patches. Fixed in all active branches.

--
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue19624] Switch constants in the errno module to IntEnum

2013-11-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> An option is to rename the C errno module to _errno and leave it
> unchanged, and provide a Python errno module which enum API.

I agree it sounds reasonable.

> Using enum for errno should not slow down Python startup time.

enum imports OrderedDict from collections, which imports other modules...

--
nosy: +pitrou

___
Python tracker 

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



[issue19624] Switch constants in the errno module to IntEnum

2013-11-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Note that even if errno is migrated to enum, OSErrors raised by the interpreter 
will still have a raw int errno...

--

___
Python tracker 

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



[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args

2013-11-28 Thread Eli Bendersky

Eli Bendersky added the comment:

If I don't see any further objections I'll go ahead and commit this by the end 
of the week

--

___
Python tracker 

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



[issue19822] PEP process entrypoint

2013-11-28 Thread anatoly techtonik

anatoly techtonik added the comment:

> The process you are describing is not correct. In particular, the discussion 
> happens before sending in a pull request.

Post the link to correct process into README.rst and then this issue can be 
closed.

As for python-dev, I thought it is too obvious and minor issue (still issue) to 
raise there, so it is just a matter of somebody with knowledge, time and commit 
privileges to commit the patch. It may worth to raise the question there anyway 
as I see that communicating usability concerns is a big problem.

--
resolution: invalid -> 
status: closed -> open

___
Python tracker 

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



[issue19624] Switch constants in the errno module to IntEnum

2013-11-28 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

I'm not sure whether changing the errno module to use enums would be 
conceptually correct:

enums declare a fixed set of permitted values, but errno values can be any 
integer, are platform dependent and are sometimes not unique (e.g. EWOULDBLOCK 
= EAGAIN, or the various Windows WSA errno values which map to similar integers 
as the Unix ones).

--
nosy: +lemburg

___
Python tracker 

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



[issue19822] PEP process entrypoint

2013-11-28 Thread Christian Heimes

Christian Heimes added the comment:

The ticket has been closed by two people. Why do you keep re-opening the ticket?

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue19799] Clarifications for the documentation of pathlib

2013-11-28 Thread Eli Bendersky

Eli Bendersky added the comment:

Committed in 90b56ec318b6

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed
versions: +Python 3.2 -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



[issue19823] for-each on list aborts earlier than expected

2013-11-28 Thread Matthew Barnett

Matthew Barnett added the comment:

This issue is best posted to python-list and only posted here if it's agreed 
that it's a bug.

Anyway:

1. You have "self.flows" and "flows", but haven't said what they are.

2. It's recommended that you don't modify a collection while iterating over it, 
but, instead, build a new collection and then the old one with the new one.

--
nosy: +mrabarnett

___
Python tracker 

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



[issue19823] for-each on list aborts earlier than expected

2013-11-28 Thread cost6

cost6 added the comment:

Sorry for that, i will move it to python-list.

--
resolution:  -> works for me
status: open -> closed

___
Python tracker 

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



[issue19822] PEP process entrypoint

2013-11-28 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 28.11.2013 15:45, anatoly techtonik wrote:
> 
> anatoly techtonik added the comment:
> 
>> The process you are describing is not correct. In particular, the discussion 
>> happens before sending in a pull request.
> 
> Post the link to correct process into README.rst and then this issue can be 
> closed.

The repo readme is not the right place for this. Christian already mentioned
the PEPs and anything should go into the dev guide.

If you have something to contribute, please open a ticket, add a patch
and request review.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

--

___
Python tracker 

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



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-28 Thread Christian Heimes

Christian Heimes added the comment:

My patch could be much simpler and easier if we could just drop support for 
ancient versions of OpenSSL. My idea requires at least OpenSSL 0.9.8f (release 
2007) with SNI support. Six years are a lot for crypto software. All relevant 
platforms with vendor support have a more recent version of OpenSSL, too.

>>> context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
>>> context.verify_mode = ssl.CERT_REQUIRED
>>> context.check_hostname = True
>>> context.wrap_socket(sock, server_hostname="www.example.org")

server_hostname is used to for server name indicator (SNI) as well as the 
hostname for match_hostname(). It would remove lots and lots of code 
duplication, too.

The check_hostname takes care about invalid combinations, too:

>>> context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
>>> context.verify_mode == ssl.CERT_NONE
True
>>> context.check_hostname = True
Traceback (most recent call last):
  File "", line 1, in 
ValueError: check_hostname needs a SSL context with either CERT_OPTIONAL or 
CERT_REQUIRED

--

___
Python tracker 

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



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> My patch could be much simpler and easier if we could just drop
> support for ancient versions of OpenSSL. My idea requires at least
> OpenSSL 0.9.8f (release 2007) with SNI support. 

What are you talking about? Your patch doesn't use HAS_SNI.

--

___
Python tracker 

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread STINNER Victor

STINNER Victor added the comment:

2013/11/28 Antoine Pitrou :
> Calling it _PyThread_set_key_value is prone to confusion.
> Ideally we would fix PyThread_set_key_value's behaviour. Are there users of 
> the function outside from CPython?

PyThread_set_key_value() is defined and used in CPython, and defined
in the cpyext module of PyPy.

I found two usages of the function:
"pygobject2:/pygobject-2.28.6/glib/pygmainloop.c"
and"pytools:/Servicing/1.1/Release/Product/Python/PyDebugAttach/PyDebugAttach.cpp"
http://searchcode.com/codesearch/view/21308375
http://searchcode.com/codesearch/view/10353970

PyThread_delete_key_value() is always called before
PyThread_set_key_value() (with the same key). So these projects would
not be impacted by the change. I guess that the key is deleted to
workaround the current limitation ("strange behaviour") of
PyThread_set_key_value().

I cannot find pygmainloop.c in the latest development version:
https://git.gnome.org/browse/pygobject/tree/gi/_glib

I searched for usage at:

http://code.ohloh.net/
https://github.com/search/
http://searchcode.com/
http://stackoverflow.com/search

It's hard to find usage of PyThread_set_key_value() before they are a
lot of copies of CPython in the search engines, and I don't know how
to filter.

Victor

--

___
Python tracker 

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



[issue19764] subprocess: use PROC_THREAD_ATTRIBUTE_HANDLE_LIST with STARTUPINFOEX on Windows Vista

2013-11-28 Thread STINNER Victor

STINNER Victor added the comment:

I read again the following blog post:
http://blogs.msdn.com/b/oldnewthing/archive/2011/12/16/10248328.aspx

I understood the purpose of PROC_THREAD_ATTRIBUTE_HANDLE_LIST.

Let say that two Python threads create a Popen object with a pipe for stdout:

* Thread A : pipe 1
* Thread B : pipe 2
* Main thread has random inheritable files and sockets

Handles of the both pipes are inheritable. Currently, thread A may inherit pipe 
2 and thread B may inherit pipe 1 depending exactly when pipes are created and 
marked as inheritable, and when CreateProcess() is called.

Using PROC_THREAD_ATTRIBUTE_HANDLE_LIST, thread A will only inherit pipe 1, not 
pipe 2 nor inheritable handles of the other threads. Thread B will only inherit 
pipe 1, no other handle. It does not matter that CreateProcess() is called with 
bInheritHandles=TRUE nor that there are other inheritable handles.

--

___
Python tracker 

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Charles-François Natali

Charles-François Natali added the comment:

> Antoine Pitrou added the comment:
>
> Calling it _PyThread_set_key_value is prone to confusion.
> Ideally we would fix PyThread_set_key_value's behaviour. Are there users of 
> the function outside from CPython?

The question is why does it behave this way in the first place?
Maybe for sub-interpreters?

--

___
Python tracker 

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



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-28 Thread Christian Heimes

Changes by Christian Heimes :


Removed file: http://bugs.python.org/file32831/check_hostname.patch

___
Python tracker 

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



[issue19824] string.Template: Add PHP-style variable expansion example

2013-11-28 Thread anatoly techtonik

New submission from anatoly techtonik:

http://docs.python.org/2/library/string.html#template-strings

This class could be more useful with the following example:

>>> from string import Template
>>> t = Template('$who likes $what')
>>> who = 'tim'
>>> what = 'kung pao'
>>> t.substitute(locals())
'tim likes kung pao'

This will help PHP folks to transition their .php files.

--
assignee: docs@python
components: Documentation
messages: 204677
nosy: docs@python, techtonik
priority: normal
severity: normal
status: open
title: string.Template: Add PHP-style variable expansion example

___
Python tracker 

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



[issue14910] argparse: disable abbreviation

2013-11-28 Thread paul j3

paul j3 added the comment:

For a programmer who needs to turn off this abbreviation matching now, a simple 
solution is to subclass ArgumentParser:

class MyParser(ArgumentParser):
def _get_option_tuples(self, option_string):
return []

This could be the place to implement more specialized matching (e.g. do not 
match on strings like '--sync').

--
nosy: +paul.j3

___
Python tracker 

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



[issue19822] PEP process entrypoint

2013-11-28 Thread anatoly techtonik

anatoly techtonik added the comment:

> The ticket has been closed by two people. Why do you keep re-opening the 
> ticket?

Because you're not providing any arguments. If it is not important for you, 
just ignore. If something is not clear - ask. What you do is just closing the 
stuff, because you _feel_ that is not an issue. Provide rationale, address my 
points and then I'll close it myself. The particular stuff that is not 
clarified:

>> Post the link to correct process into README.rst and then this
>> issue can be closed.
> The repo readme is not the right place for this. Christian already
> mentioned the PEPs and anything should go into the dev guide.

I want to know why PEPs repository README is not the place to direct users to 
starting point for submitting enhancement proposals?

> If you have something to contribute, please open a ticket, add a patch
and request review.

I am already keep opening it, damn. I want to contribute an improvement for the 
PEP process and not forget about it. That's why I fill in into tracker, and not 
into email.

--
resolution: invalid -> postponed
status: closed -> open

___
Python tracker 

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread STINNER Victor

STINNER Victor added the comment:

> The question is why does it behave this way in the first place?
> Maybe for sub-interpreters?

The code is old. I don't think that it's related to subinterpreter.

PyThread_set_key_value() is used in _PyGILState_Init() and PyGILState_Ensure(), 
but its behaviour when the key already exists doesn't matter because these 
functions only call PyThread_set_key_value() once pr thread. It was probably 
simpler to implement PyThread_set_key_value() like it is nowadays. When the 
native TLS support was added, the new functions just mimic the old behaviour.


Code history.

find_key() function has been added at the same time than the PyThreadState 
structure. set_key_value() was already doing nothing when the key already 
exists. It looks like set_key_value() was not used.
---
changeset:   5405:b7871ca930ad
branch:  legacy-trunk
user:Guido van Rossum 
date:Mon May 05 20:56:21 1997 +
files:   Include/Python.h Include/frameobject.h Include/pystate.h 
Include/pythread.h Include/thread.h Modules/threadmodule.c Objects/frameobject
description:
Massive changes for separate thread state management.
All per-thread globals are moved into a struct which is manipulated
separately.
---

TLS only started to be used in CPython since the following major change:
---
changeset:   28694:a4154dd5939a
branch:  legacy-trunk
user:Mark Hammond 
date:Sat Apr 19 15:41:53 2003 +
files:   Include/pystate.h Include/pythread.h Lib/test/test_capi.py 
Modules/_testcapimodule.c Modules/posixmodule.c Python/ceval.c Python/pystat
description:
New PyGILState_ API - implements pep 311, from patch 684256.
---

Native TLS support is very recent (compared to the first commit):
---
changeset:   64844:8e428b8e7d81
user:Kristján Valur Jónsson 
date:Mon Sep 20 02:11:49 2010 +
files:   Python/pystate.c Python/thread_nt.h Python/thread_pthread.h
description:
issue 9786 Native TLS support for pthreads
PyThread_create_key now has a failure mode that the applicatino can detect.
---

--
nosy: +kristjan.jonsson

___
Python tracker 

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



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-28 Thread Christian Heimes

Christian Heimes added the comment:

The patches in the dependency tickets are using SNI. The problem is, a non-None 
server_hostname argument raises an error when OpenSSL doesn't support the 
feature.

Here is a demo patch for my idea. It makes it very easy to add hostname 
matching to existing code. All it takes is the "server_hostname" argument to 
wrap_socket() and a new property "check_hostname" for the SSLContext object. 
The rest is done in do_handshake().

--
Added file: http://bugs.python.org/file32881/sslctx_check_hostname.patch

___
Python tracker 

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



[issue19824] string.Template: Add PHP-style variable expansion example

2013-11-28 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue19824] string.Template: Add PHP-style variable expansion example

2013-11-28 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Nov 28, 2013, at 05:07 PM, anatoly techtonik wrote:

>This class could be more useful with the following example:
>
 from string import Template
 t = Template('$who likes $what')
 who = 'tim'
 what = 'kung pao'
 t.substitute(locals())
>'tim likes kung pao'
>
>This will help PHP folks to transition their .php files.

I'm not sure what you want to add to the class.  Your example works out of the
box.  See this for an approach my third party library takes:

http://pythonhosted.org/flufl.i18n/docs/using.html#substitutions-and-placeholders

--

___
Python tracker 

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



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> The patches in the dependency tickets are using SNI.

They all check for HAS_SNI, which is simple enough.
If you want to discuss a minimum supported OpenSSL version, that's fine with 
me, but it should be a separate discussion (on python-dev?).

If you think your patches are not ready, then please say so, so that I don't 
review them.

--

___
Python tracker 

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



[issue19822] PEP process entrypoint

2013-11-28 Thread STINNER Victor

STINNER Victor added the comment:

Anatoly, please stop reopening the issue, it's *really* annoying. Not
only you failed to understand correctly your problem (it looks like
nor Christian nor Marc-Andre nor me understood your request), but it
looks like you don't care of our answers.

> PEP repository readme lacks information about how to send Python Enhancement 
> Proposal step-by-step.

Did you at least read the *first* PEP, the PEP which describes the PEP process?
http://www.python.org/dev/peps/pep-0001/

Did you also read the developer guide? The PEP process is also explained there:
http://docs.python.org/devguide/langchanges.html#pep-process

> What I propose it to make PEP repository self-sufficient,

The PEP 1, 9 and 12 are already included in the PEP repository.

I don't understand why you are focused on the README.rst file. PEPs
are more convinient because automatically exported online at:
http://www.python.org/dev/peps/

For example, you must read:
http://www.python.org/dev/peps/pep-0001/

> I am already keep opening it, damn. I want to contribute an improvement for 
> the PEP process and not forget about it. That's why I fill in into tracker, 
> and not into email.

The PEP process is already well described, so your issue is invalid.

You don't propose anything concrete. Example of concrete thing: a
patch on the pep-0001.rst or on README.rst. Or contribute to the
devguide.

Did you sign the contributor agreement?
http://docs.python.org/devguide/coredev.html#sign-a-contributor-agreement

I know that you don't want to sign it, even if I don't understand why
(please don't start discuss it here, the legal mailing list is the
right place), but it's required to contribute to CPython.

--

The PEP process is not so formal. Just start discussing an idea on
python-idea, don't worry of the exact structure of a PEP document. It
can be written later. It is a waste of time to write a full PEP if an
idea is quickly rejected.

--

___
Python tracker 

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



[issue19824] string.Template: Add PHP-style variable expansion example

2013-11-28 Thread anatoly techtonik

anatoly techtonik added the comment:

There is nothing to add to the class itself. It is about expanding docs section 
with helpful examples. `string.Template` is undervalued, because it is hard to 
see how it can be more useful than standard string formatting functions. But 
for people coming from PHP world, this can be a good start. The docs just need 
an entrypoint that shows how to use locally defined variables in template 
string. PHP does this for strings automatically.

--

___
Python tracker 

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



[issue19824] string.Template: Add PHP-style variable expansion example

2013-11-28 Thread Alex Gaynor

Alex Gaynor added the comment:

Using locals() in this fashion is a serious anti-pattern, I'm -∞ on the docs 
suggesting it.

--
nosy: +alex

___
Python tracker 

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



[issue19825] test b.p.o email interface

2013-11-28 Thread anatoly techtonik

New submission from anatoly techtonik:

--
anatoly t.

--
messages: 204688
nosy: techtonik
priority: normal
severity: normal
status: open
title: test b.p.o email interface

___
Python tracker 

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



[issue19822] PEP process entrypoint

2013-11-28 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue19825] test b.p.o email interface

2013-11-28 Thread anatoly techtonik

anatoly techtonik added the comment:

Closing by email using [status=closed;resolution=invalid] suffix in header.

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue19813] Add a new optional timeout parameter to socket.socket() constructor

2013-11-28 Thread Charles-François Natali

Charles-François Natali added the comment:

I'm with Antoine, this is *really* going too far.
SOCK_CLOEXEC and friends are useful to avoid race conditions: there's
no such concern with the non-blocking flag.
Shaving one or two syscalls is IMO completely useless, and doesn't
justify the extra code and, more importantly, clutter in the
constructor.
I'm -10.

--

___
Python tracker 

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

Deja vu, this has come up before.  I wanted to change this because native TLS 
implementation become awkward.

https://mail.python.org/pipermail/python-dev/2008-August/081847.html

--

___
Python tracker 

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

See also issue #10517

--

___
Python tracker 

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



[issue19826] Document that bug reporting by email is possible

2013-11-28 Thread anatoly techtonik

New submission from anatoly techtonik:

I found this to be convenient: 
http://techtonik.rainforce.org/2013/11/roundup-tracker-create-issues-by-email.html

And this is missing from here: 
http://docs.python.org/release/2.7/bugs.html#using-the-python-issue-tracker
Anf from here:
http://docs.python.org/devguide/triaging.html

Disclaimer: I didn't sign the CLA, and people keep telling me that I need it to 
do documentation edits. But I edit Wikipedia freely and I find it wrong that I 
can not edit Python documentation without signing papers. So I am not sending 
patches until either Wikipedia requires CLA to edit its contents, or PSF 
abandons its ill FUD policies in favor of creating collaborative environment.

Regarding my aforementioned blog post, feel free to copy-paste it, as an author 
I release this into CC0/public domain. Ask python-legal-sig if it is enough.

--
assignee: docs@python
components: Documentation
messages: 204693
nosy: docs@python, techtonik
priority: normal
severity: normal
status: open
title: Document that bug reporting by email is possible

___
Python tracker 

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



[issue19813] Add a new optional timeout parameter to socket.socket() constructor

2013-11-28 Thread Guido van Rossum

Guido van Rossum added the comment:

OK, let's forget about it.

--
resolution:  -> wont fix
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue19824] string.Template: Add PHP-style variable expansion example

2013-11-28 Thread anatoly techtonik

anatoly techtonik added the comment:

@Alex, have you seen 
http://pythonhosted.org/flufl.i18n/docs/using.html#substitutions-and-placeholders?
 I really like the brevity, and it is the function that does the magic, so it 
is fully transparent and you don't need to instantiate string.Template every 
time. I think its awesome.

Do you have some explanations why passing locals() to string.Template is 
anti-pattern? I understand that passing "all that you have" is not good, but 
from my past experience with PHP I can't remember any problems that there are 
more names than I used. It is templating after all - what do you want to 
protect from?

--

___
Python tracker 

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



[issue19822] PEP process entrypoint

2013-11-28 Thread Georg Brandl

Georg Brandl added the comment:

Closing for the hopefully final time.  Anatoly, if you keep reopening this 
ticket you have to expect removal of tracker privileges.

--
nosy: +georg.brandl
resolution: postponed -> rejected
status: open -> closed

___
Python tracker 

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



[issue19821] pydoc.ispackage() could be more accurate

2013-11-28 Thread Claudiu.Popa

Claudiu.Popa added the comment:

It was used by pydoc.py until 2006, when it was removed with this commit: 

Changeset:
37821 (3135648026c4) Second phase of refactoring for runpy, pkgutil, pydoc, and 
setuptools.

Is it worth to fix this?

--
nosy: +Claudiu.Popa

___
Python tracker 

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



[issue19827] Optimize socket.settimeout() and socket.setblocking(): avoid syscall

2013-11-28 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch avoids a syscall on socket.setblocking() and socket.settimeout() 
when possible: use ioctl(FIONBIO) when available (not only on VMS), or use 
fcntl() but only call fcntl() twice if the flags changed.

The fcntl() optimization was suggested by Peter Portante some months ago:
https://mail.python.org/pipermail/python-dev/2013-January/123661.html

See also the rejected issue #19813: "Add a new optional timeout parameter to 
socket.socket() constructor".

--
components: Library (Lib)
files: socket.patch
keywords: patch
messages: 204698
nosy: haypo
priority: normal
severity: normal
status: open
title: Optimize socket.settimeout() and socket.setblocking(): avoid syscall
type: performance
versions: Python 3.4
Added file: http://bugs.python.org/file32882/socket.patch

___
Python tracker 

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



[issue19824] string.Template: Add PHP-style variable expansion example

2013-11-28 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

A few notes about flufl.i18n's style.  We chose this (extracted from the GNU
Mailman project) because $strings are *way* less error prone for translators
than %s strings, especially when you consider that some languages change the
order of placeholders.  The automatic extraction of substitutions from locals
and globals (under the hood, via the sys._getframe() hack) was critical to
making the source code readable, by avoiding not just duplication, but
triplication of names.

There is a potential security hole though - a malicious translator with access
to the source could analyze the local and global context in which the
translation+substitution is being made, and craft a gettext catalog that adds
some new substitutions that expose sensitive information.  Given that most
translations get little scrutiny, this could be used as an attack vector for
users of some languages (though not English, since it's typically the source
language and thus not translated).

We've decided to accept the risks in exchange for the huge convenience.  We've
never seen such an attack and if we did, we'd address it in the code by
manipulating the globals and locals to avoid the possibility of a leak.  (We'd
also learn to never trust the translators that added the hack.)

--

___
Python tracker 

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



[issue19813] Add a new optional timeout parameter to socket.socket() constructor

2013-11-28 Thread STINNER Victor

STINNER Victor added the comment:

I don't see what I can do against a -10 vote! :-)

I opened the issue #19827 for the simple syscall optimization.

--

___
Python tracker 

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



[issue19352] unittest loader barfs on symlinks

2013-11-28 Thread Matthias Klose

Matthias Klose added the comment:

re-opening. the patch did break autopilot running with 2.7 on Ubuntu. I don't 
yet understand what this patch is supposed to fix.

--
nosy: +doko
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue19352] unittest loader barfs on symlinks

2013-11-28 Thread Matthias Klose

Matthias Klose added the comment:

see https://launchpad.net/bugs/1255505

--

___
Python tracker 

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread STINNER Victor

STINNER Victor added the comment:

Attached patch fix PyThread_set_key_value() instead of adding a new function.

I prefer fix_set_key_value.patch instead of pythread_set_key_value.patch 
because I feel bad of keeping a buggy function and having to decide between a 
correct and a buggy version of the same function.

> Deja vu, this has come up before.  I wanted to change this because native TLS 
> implementation become awkward.
> https://mail.python.org/pipermail/python-dev/2008-August/081847.html

You didn't get answer to this old email :-( I suppose that you still want to 
fix PyThread_set_key_value()?

--
Added file: http://bugs.python.org/file32883/fix_set_key_value.patch

___
Python tracker 

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

But yes, I'd like to see this behave like normal.

--

___
Python tracker 

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

Please see the rather long discussion in http://bugs.python.org/issue10517
There were issues having to do with fork.

--

___
Python tracker 

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread STINNER Victor

STINNER Victor added the comment:

> Please see the rather long discussion in http://bugs.python.org/issue10517
> There were issues having to do with fork.

Python has now a _PyGILState_Reinit() function.

I don't see how fix_set_key_value.patch would make the situation worse. What is 
the link between this issue and the issue #10517.

--

___
Python tracker 

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Charles-François Natali

Charles-François Natali added the comment:

AFAICT, there's no link (FWIW I wrote the patch for #10517, then the fix
for threads created outside of Python calling into a subinterpreter -
issue #13156).
Actually, this "fix" would have avoided the regression in issue #13156.
But since it's tricky, I'd really like if Graham could test it (his module
does a lot of nasty things that could not show up in our test suite).

--
nosy: +grahamd

___
Python tracker 

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

Only that issue #10517 mentions reasons to keep the old behavior, specifically 
http://bugs.python.org/issue10517#msg134573
I don't know if any of the old arguments are still valid, but I suggested 
changing this years ago and there was always some objection or other.

--

___
Python tracker 

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



[issue19790] ctypes can't load a c++ dll if the dll calls COM on Windows 8

2013-11-28 Thread yinkaisheng

yinkaisheng added the comment:

After debugging, I found the reason.
when ctypes loads the dll, CoCreateInstance blocks the flow.

If I don't call CoCreateInstance in function DllMain. ctypes can load the dll.

I should call function CoCreateInstance after DllMain was called. 

The problem was fixed.

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue19352] unittest loader barfs on symlinks

2013-11-28 Thread Martin Pitt

Martin Pitt added the comment:

More precisely, it broke unittest's discovery (not specific to autopilot). For 
any installed test, you now get:

$ python -m unittest discover lazr
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
  File "/usr/lib/python2.7/unittest/__main__.py", line 12, in 
main(module=None)
  File "/usr/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
  File "/usr/lib/python2.7/unittest/main.py", line 113, in parseArgs
self._do_discovery(argv[2:])
  File "/usr/lib/python2.7/unittest/main.py", line 214, in _do_discovery
self.test = loader.discover(start_dir, pattern, top_level_dir)
  File "/usr/lib/python2.7/unittest/loader.py", line 206, in discover
tests = list(self._find_tests(start_dir, pattern))
  File "/usr/lib/python2.7/unittest/loader.py", line 287, in _find_tests
for test in self._find_tests(full_path, pattern):
  File "/usr/lib/python2.7/unittest/loader.py", line 287, in _find_tests
for test in self._find_tests(full_path, pattern):
  File "/usr/lib/python2.7/unittest/loader.py", line 267, in _find_tests
raise ImportError(msg % (mod_name, module_dir, expected_dir))
ImportError: 'test_error' module incorrectly imported from 
'/usr/lib/python2.7/dist-packages/lazr/restfulclient/tests'. Expected 
'/usr/lib/python2.7/dist-packages/lazr/restfulclient/tests'. Is this module 
globally installed?

I reverted this patch in Ubuntu for now as a quickfix.

This might be specific how Debian installs Python 2 modules. Packages ship them 
in /usr/share/pyshared//, and for every supported 2.X version, ship 
/usr/lib/python2.X/dist-packages// which contains only the 
directories and *.pyc files, but symlinks the *.py files to 
/usr/share/pyshared//../*.py

So, it might be that upstream does not support this symlink layout, but it's 
the best thing to avoid having to install multiple *.py copies (this is all 
solved in a much more elegant way with Python 3, of course). But it would be 
nice if unittest's discovery could still cope with this.

Thanks!

--
nosy: +pitti

___
Python tracker 

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