[issue20383] Add a keyword-only spec argument to types.ModuleType

2014-05-26 Thread Eric Snow

Eric Snow added the comment:

Okay, I didn't read closely enough. :)  It may be worth updating the title.

FWIW, the name module_from_spec confused me at first because my brain 
interpreted that as load_from_spec.  Keeping the name and purpose more 
focused might be helpful.  I have comments below to that effect.

If your proposed change still makes sense, could we keep it simpler for now?  
Something like this:

# in importlib.util
def module_from_spec(spec, module=None):
...
methods = _bootstrap._SpecMethods(spec)
if module is None:
return methods.create()
else:
methods.init_module_attrs(methods)
return module

Keeping the 2 methods on _SpecMethods is helpful for the PEP 406 (ImportEngine) 
superseder that I still want to get back to for 3.5. :)

--

 This serves two purposes. One is that it abstracts the
 loader.create_module() dance out so that's no longer a worry.

I'm not sure what dance you mean here and what the worry is.

 But more crucially it also means that if you have the function
 create the module for you then it will be returned with all of
 its attributes set without having to worry about forgetting that
 step.

So we would discourage calling ModuleType directly and encourage the use of a 
function in importlib.util that is equivalent to _SpecMethods.create().  That 
sounds good to me.  The use case for creating module objects directly is a 
pretty advanced one, but having a public API for that would still be good.

From this point of view I'd expect it to just look like this:

def new_module(spec):
return _SpecMethods(spec).create()

or given what I expect is the common use case currently:

def new_module(name, loader):
spec = spec_from_loader(name, loader)
return _SpecMethods(spec).create()

or together:

def new_module(spec_or_name, /, loader=None):
if isinstance(spec_or_name, str):
name = spec_or_name
if loader is None:
raise TypeError('missing loader')
spec = spec_from_loader(name, loader)
else:
if loader is not None:
raise TypeError('got unexpected keyword argument loader')
spec = spec_or_name
return _SpecMethods(spec).create()

To kill 2 birds with 1 stone, you could even make that the new signature of 
ModuleType(), which would just do the equivalent under the hood.  That way 
people keep using the same API that they already are (no need to communicate a 
new one to them), but they still get the appropriate attributes set properly.

 The module argument is just for convenience in those
 instances where you truly only want to override the module
 creation dance for some reason and really just want the
 attribute setting bit.

Perhaps it would be better to have a separate function for that (equivalent to 
just _SpecMethods.init_module_attrs()).  However, isn't that an even more 
uncommon use case outside of the import system itself?

 About the only other thing I can think of that people might
 still want is something like `importlib.util.load(spec)`

I agree it's somewhat orthogonal.  I'll address comments to issue #21235.

--

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



[issue21235] importlib's spec module create algorithm is not exposed

2014-05-26 Thread Eric Snow

Eric Snow added the comment:

How about this replacement for direct use of Loader.load_module():

# in importlib.util
def load(spec_or_name, /, **kwargs):  # or load_from_spec
if isinstance(spec_or_name, str):
name = spec_or_name
if not kwargs:
raise TypeError('missing loader')
spec = spec_from_loader(name, **kwargs)
else:
if kwargs:
raise TypeError('got unexpected keyword arguments')
spec = spec_or_name
return _SpecMethods(spec).load()

(See a similar proposal for new_module() in msg219135, issue #20383).

--

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Berker Peksag

Berker Peksag added the comment:

See issue 18879 for more information about the change.

--
nosy: +berker.peksag, pitrou

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



[issue18879] tempfile.NamedTemporaryFile can close the file too early, if not assigning to a variable

2014-05-26 Thread Марк Коренберг

Марк Коренберг added the comment:

Is issue 21579 fixed in that bug? too many letters..sorry...

--
nosy: +mmarkk

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



[issue8743] set() operators don't work with collections.Set instances

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cd8b5b5b6356 by Raymond Hettinger in branch '3.4':
Issue 8743: Improve interoperability between sets and the collections.Set 
abstract base class.
http://hg.python.org/cpython/rev/cd8b5b5b6356

--

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



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ba84d1e9a742 by Raymond Hettinger in branch '2.7':
Issue #21481:  Teach argparse equality tests to return NotImplemented when 
comparing to unknown types.
http://hg.python.org/cpython/rev/ba84d1e9a742

--
nosy: +python-dev

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



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 510c8dc38749 by Raymond Hettinger in branch '3.4':
Issue #21481:  Teach argparse equality tests to return NotImplemented when 
comparing to unknown types.
http://hg.python.org/cpython/rev/510c8dc38749

--

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



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - fixed
status: open - closed

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



[issue13212] json library is decoding/encoding when it should not

2014-05-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: rhettinger - bob.ippolito
nosy: +bob.ippolito

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



[issue13212] json library is decoding/encoding when it should not

2014-05-26 Thread Bob Ippolito

Bob Ippolito added the comment:

As Chris Rebert mentioned, the JSON standards have adopted this (unsurprising) 
behavior. Ruby hasn't, and I doubt Crockford has, but I think they're in the 
minority at this point. JavaScript's own JSON implementation works the same way 
json/simplejson does.

 JSON.parse(JSON.stringify('yay'))
yay

At best, I think it's probably worth a mention in the documentation, but not 
worth changing any code over.

--

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



[issue13212] json library is decoding/encoding when it should not

2014-05-26 Thread Bob Ippolito

Bob Ippolito added the comment:

In other words, I would consider this to be fixed by the documentation change 
made elsewhere.

--

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



[issue8743] set() operators don't work with collections.Set instances

2014-05-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - fixed
status: open - closed

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



[issue21575] list.sort() should show arguments in tutorial

2014-05-26 Thread Jan-Philip Gehrcke

Jan-Philip Gehrcke added the comment:

I have updated the patch with a cross-reference to the sorted() built-in, which 
explains the arguments.

W.r.t. to Éric's suggestion: the sorted() doc refers to the sorting howto in 
the wiki. Now everything is connected.

--
Added file: http://bugs.python.org/file35365/sort_tut_02.diff

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



[issue21575] list.sort() should show arguments in tutorial

2014-05-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: docs@python - rhettinger

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



[issue21580] PhotoImage(data=...) apparently has to be UTF-8 or Base-64 encoded

2014-05-26 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +gpolo, serhiy.storchaka

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +georg.brandl, ncoghlan

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



[issue20664] _findLib_crle and _get_soname broken on latest SunOS 5.11

2014-05-26 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +amaury.forgeotdarc, belopolsky, meador.inge

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



[issue21560] gzip.write changes trailer ISIZE field before type checking - corrupted gz file after trying to write string

2014-05-26 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +nadeem.vawda

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



[issue13355] random.triangular error when low = high=mode

2014-05-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Note the catch on 2.7. triangular(10, 10.0) returns 10.0, but triangular(10, 
10.0, 10.0) returns 10. If then you divide by the result...

I proposed change return low to return low + 0.0.

--

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In any case this trick didn't work on Windows. And it can't work on Linux too 
when use new O_TMPFILE flag (issue21515).

--
nosy: +serhiy.storchaka

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +haypo

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Марк Коренберг

Марк Коренберг added the comment:

Yes, but O_TMPFILE should be set ONLY  when used with TemporaryFile, not with 
NamedTemporaryFile. My problem refer only NamedTemporaryFile.

--

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



[issue21578] Misleading error message when ImportError called with invalid keyword args

2014-05-26 Thread Berker Peksag

Berker Peksag added the comment:

Here's a patch with a simple test case.

--
keywords: +patch
nosy: +berker.peksag
stage: needs patch - patch review
Added file: http://bugs.python.org/file35366/issue21578.diff

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



[issue21054] Improve indexing of syntax symbols

2014-05-26 Thread Ezio Melotti

Ezio Melotti added the comment:

All the current dependences are currently fixed.
Are you planning to add more in the future or can this issue be closed?

--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python, ezio.melotti
type:  - enhancement

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



[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2014-05-26 Thread Sunny K

Sunny K added the comment:

Hi Stefan,

I've added a new patch which only adds _fields, combining parts from my earlier 
patch and Andrew's (his patch does not account for visible unnamed fields).

--
Added file: http://bugs.python.org/file35367/structseq_fields.patch

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



[issue21072] Python docs and downloads not available for Egypt

2014-05-26 Thread Ezio Melotti

Ezio Melotti added the comment:

IIUC there was a similar issue from China, and on the old site we fixed it by 
adding http://legacy.python.org/getit/.
I don't know what was made to this page to make it work from China and if it 
still exists on the new website, but maybe the same trick could be used in this 
case as well?

Leo, can you check if the link I posted above works for you and try 
http://legacy.python.org/download/ as well?

--
nosy: +ezio.melotti

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



[issue21077] Turtle Circle Speed 0

2014-05-26 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
stage:  - needs patch
type:  - behavior

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



[issue21310] ResourceWarning when open() fails with io.UnsupportedOperation: File or stream is not seekable

2014-05-26 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +haypo, pitrou, serhiy.storchaka
type:  - behavior

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



[issue21429] Input.output error with multiprocessing

2014-05-26 Thread Ezio Melotti

Ezio Melotti added the comment:

Can you provide more information about the error (e.g. the relevant piece of 
code where the error generates, if you can reproduce it every time or if it's 
sporadic, a minimal piece of code that can reproduce the same issue, etc.)?
I would also suggest to report this to the supybot issue tracker if the 
affected code is not specific to Limnoria.

--
nosy: +ezio.melotti
type:  - behavior

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



[issue21434] python -3 documentation is outdated

2014-05-26 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +terry.reedy
stage: patch review - commit review
type:  - enhancement

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



[issue21445] Some asserts in test_filecmp have the wrong messages

2014-05-26 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
stage:  - commit review

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-26 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +serhiy.storchaka

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



[issue21310] ResourceWarning when open() fails with io.UnsupportedOperation: File or stream is not seekable

2014-05-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue20074.

--

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



[issue19980] Improve help('non-topic') response

2014-05-26 Thread Mark Lawrence

Mark Lawrence added the comment:

Anybody?

--

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



[issue21072] Python docs and downloads not available for Egypt

2014-05-26 Thread Leo Butcher

Leo Butcher added the comment:

Still not working, they both timeout
also the docs subdomain is the same

On Mon, May 26, 2014 at 12:19 PM, Ezio Melotti rep...@bugs.python.orgwrote:


 Ezio Melotti added the comment:

 IIUC there was a similar issue from China, and on the old site we fixed it
 by adding http://legacy.python.org/getit/.
 I don't know what was made to this page to make it work from China and if
 it still exists on the new website, but maybe the same trick could be used
 in this case as well?

 Leo, can you check if the link I posted above works for you and try
 http://legacy.python.org/download/ as well?

 --
 nosy: +ezio.melotti

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue21072
 ___


--

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



[issue20383] Add a keyword-only spec argument to types.ModuleType

2014-05-26 Thread Brett Cannon

Brett Cannon added the comment:

First, about breaking up _SpecMethods: that was entirely on purpose. =) I 
honestly have found _SpecMethods a bit of a pain to work with because at every 
place where I have a spec object and I need to operate on it I end up having to 
wrap it and then call a method on it instead of simply calling a function (it 
also doesn't help that spec methods is structured as a collection of methods 
which can just operate as functions since they almost all have ``spec = 
self.spec`` at the beginning). I get you're hoping to make PEP 406 happen, but 
it actually needs to happen first. =) And as I said, the methods are 
essentially functions anyway so undoing any unraveling I may do won't be 
difficult to revert if PEP 406 actually comes about. IOW _SpecMethods feels 
like OOP just 'cause and not for any design reasons; it's been making my eye 
twitch when I look at that class.

Second, the dance that an advanced user has to worry about is does 
create_module exist, and if so did it not return None and if any of that is not 
true then return what types.ModuleType would give you is not exactly one line 
of code ATM. There is no reason to not abstract that out to do the right thing 
in the face of a loader.

Third, yes this would be to encourage people not to directly call 
types.ModuleType but call the utility function instead.

Fourth, I purposefully didn't bifurcate the code of types.ModuleType based on 
the type of what the first argument was. At best you could change it to take an 
optional spec as a second argument and use that, but if you did that and the 
name doesn't match the spec then what? I'm not going to promote passing in a 
loader because spec_from_loader() cannot necessarily glean all of the same 
information a hand-crafted spec could if the loader doesn't have every possible 
introspection method defined (I'm calling explicit is better than implicit to 
back that up). I also don't think any type should depend on importlib having 
been previously loaded to properly function if it isn't strictly required, so 
the code would have to be written entirely in C which I just don't want to 
write. =) Since it's going beyond simply constructing a new module but also 
initializing it I think it's fine to keeping it in importlib.util which also 
makes it all more discoverable for people than having to realize tha
 t types.ModuleType is the place to go to create a module and get its 
attributes initialized.

Fifth, fair enough on not needing the module argument. I will refactor the code 
for internal use of attribute initialization in testing and leave it at that.

--

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



[issue10510] distutils upload/register should use CRLF in HTTP requests

2014-05-26 Thread Ian Cordasco

Ian Cordasco added the comment:

Per discussion on twitter 
(https://twitter.com/merwok_/status/468518605135835136) I'm bumping this to 
make sure it's merged.

--

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



[issue21235] importlib's spec module create algorithm is not exposed

2014-05-26 Thread Brett Cannon

Brett Cannon added the comment:

I think that's the wrong abstraction(it would be fine in a third-party library, 
though, that's trying to smooth over 3.3-3.4 transitions). Since 
importlib.util.find_spec() always returns a spec, then you want something more 
like::

  def load(spec):
loader = spec.loader
if hasattr(loader, 'exec_module'):
module = importlib.util.whatever_issue_20383_leads_to()
loader.exec_module(module)
return module
else:
loader.load_module(spec.name)
return sys.modules[spec.name]

Since this is Python 3.5 code we are talking about you don't have to worry 
about the find_loader/find_module case as find_spec wraps both of those and 
normalizes it all to just using specs. You could even tweak it to pass the 
module in explicitly and in the load_module branch make sure that the module is 
placed in sys.modules first so it essentially becomes a reload (but as both 
know that's not exactly the same nor pleasant in certain cases so probably best 
not exposed that way =).

If this exists in importlib.util then you make import_module() be 
(essentially)::

  def import_module(name, package):
fullname = resolve_name(name, package)
spec = find_spec(fullname)
return load(spec)

--
dependencies: +Add a keyword-only spec argument to types.ModuleType

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



[issue21235] importlib's spec module create algorithm is not exposed

2014-05-26 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
dependencies: +Consider dropping importlib.abc.Loader.create_module()

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



[issue21581] Consider dropping importlib.abc.Loader.create_module()

2014-05-26 Thread Brett Cannon

New submission from Brett Cannon:

As Armin Ronacher pointed out, it's a bit odd having the importlib.abc.Loader 
ABC have a method whose default does nothing and having the method itself be 
entirely optional. Might as well just drop it from the ABC and instead just 
make sure that create_module() is documented appropriately (it's such an 
advanced use case it might also simplify things to not have it in the typical 
user's face).

--
components: Library (Lib)
messages: 219159
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: Consider dropping importlib.abc.Loader.create_module()
type: behavior
versions: Python 3.5

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



[issue21235] importlib's spec module create algorithm is not exposed

2014-05-26 Thread Brett Cannon

Brett Cannon added the comment:

Opened issue #21581 to discuss Armin's point about 
importlib.abc.Loader.create_module() being there but not being much use since 
the method is entirely optional.

--

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



[issue21477] Idle: improve idle_test.htest

2014-05-26 Thread Saimadhav Heblikar

Saimadhav Heblikar added the comment:

Summary for htest-26052014-34.diff and htest-26052014-27.diff
1. Adds htest for ReplaceDialog and SearchDialog
2. Removes the two canvases in TreeWidget as per code review comment. Now there 
is only a single ScrollableCanvas
3. Some text changes in spec dict messages

The corresponding 27 patch is to be applied on top of htest-25052014-27.diff.

Apart,

1. Wrt point 4 in msg219055, I think wrapper functions are required along with 
creating a new root.
It ensures the parent dialog is not destroyed, even 'accidently' and across 
different OS.
About the concern that clicking '[Next]' does not destroy the child:
We could have the following line in wrapper function(which creates a new root)-
 
parent.child = root

and, in the next() in run():
try:
root.child.destroy()
except AttributeError:
pass

To make things more readable, we could perhaps change the 'root' in run() to 
'parent' and ensure consistency.
With this, clicking '[Next]' destroys the child, before moving onto the next 
htest.
A drawback with this approach would be that, we would need to create a wrapper 
function for those tests which currently dont have one(See: configNameDialog, 
configHelpSource, GetKeysDialog etc.)



2. Htest's for GrepDialog, outputwindow, configDialog and Filelist are not 
progressing because of assert statements in macosxsupport.py.
I do not know the reasoning behind the assert statement either. Neither do I 
know how to 'ignore' it.
One way I found out is using the -O flag, but it is not pragmatic.
Another way is to have a macosxsupport._tk_type = other in the respective 
wrapper function.
But I do not know the effect of such a statement in a OSX environment.
If someone with a OSX environment wants to volunteer, please try running 
Lib/idlelib/configDialog.py with and without the insertion
macosxsupport._tk_type = other. With the insertion, the configDialog works on 
a Linux gnome environment and doesn't without it.
Funnily enough, the configDialog works as-is in Win7 which I tried on a VM.
One way would be to insert the above statment only if its a *nix environment.

--
Added file: http://bugs.python.org/file35368/htest-26052014-34.diff

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



[issue21477] Idle: improve idle_test.htest

2014-05-26 Thread Saimadhav Heblikar

Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com:


Added file: http://bugs.python.org/file35369/htest-26052014-27.diff

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



[issue21582] use the support.catpured_stdout/stderr context managers - test_asyncore

2014-05-26 Thread diana

New submission from diana:

Updated test_asyncore to use the support.catpured_stdout/stderr context 
managers rather than try/finally blocks.

--
components: Tests
files: use_support_captured_test_asyncore.patch
keywords: patch
messages: 219162
nosy: diana
priority: normal
severity: normal
status: open
title: use the support.catpured_stdout/stderr context managers - test_asyncore
versions: Python 3.5
Added file: 
http://bugs.python.org/file35370/use_support_captured_test_asyncore.patch

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



[issue21582] use support.catpured context managers - test_asyncore

2014-05-26 Thread diana

Changes by diana diana.joan.cla...@gmail.com:


--
title: use the support.catpured_stdout/stderr context managers - test_asyncore 
- use support.catpured context managers - test_asyncore

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



[issue21054] Improve indexing of syntax symbols

2014-05-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I plan to add more.

--

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



[issue21434] python -3 documentation is outdated

2014-05-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This is documentation for the 2.7 '-3' command line option, which I presume has 
not changed at least since 2.7.0, rather than for 2to3, which has changed in 
different 3.x releases. If I am correct, the list of things -3 warns about has 
not changed. It might be more appropriate to rewrite the intro sentence to 
something like

Warn about Python 3.x incompatibilities which were not fixed by the original 
version of :ref:`2to3 2to3-reference`.

Benjamin, what do you think?

--
nosy: +benjamin.peterson

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



[issue21583] use support.catpured_stderr context manager - test_logging

2014-05-26 Thread diana

New submission from diana:

- Updated test_asyncore to use the support.catpured_stderr context manager
- Removed unused imports

--
components: Tests
files: use_support_captured_stderr_test_logging.patch
keywords: patch
messages: 219165
nosy: diana
priority: normal
severity: normal
status: open
title: use support.catpured_stderr context manager - test_logging
versions: Python 3.5
Added file: 
http://bugs.python.org/file35371/use_support_captured_stderr_test_logging.patch

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



[issue19980] Improve help('non-topic') response

2014-05-26 Thread Jessica McKellar

Jessica McKellar added the comment:

@BreamoreBoy, thanks for following up on this!


 I propose the following.  help('') returns help on strings in the same way 
 that help([]) and help({}) returns help on lists and dicts respectively,

Sounds good.

 further help(''.method) returns help on the string method or an attribute 
 error, so this appears to me consistent.

This already happens (which I think you are saying, but it's a bit confusing in 
reading your message which functionality you are proposing to add and which 
functionality you are restating that already exists).

 help('doh') returns enhanced output along the lines Terry suggested in 
 msg206157.

Sounds good.

 help('module') gives the path to the module as well as the help output, if 
 any, as I think this could be useful in cases where you're looking for 
 problems and have a stdlib module masked by a file of your own.

I think you are stating the current functionality?

 Note that I've tried looking at the test code and it didn't make much sense 
 to me, pointers welcome.

Do you have specific questions?

Terry suggests that help() tests for functionality using pydoc live in 
test_pydoc.py, and that help() tests for functionality not using pydoc live in 
test_site.py.

--

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



[issue21583] use support.catpured_stderr context manager - test_logging

2014-05-26 Thread diana

diana added the comment:

oops, typo:

- Updated test_logging (not test_asyncore) to use the support.catpured_stderr 
context manager

--

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



[issue20383] Add a keyword-only spec argument to types.ModuleType

2014-05-26 Thread Eric Snow

Eric Snow added the comment:

tl;dr I'm okay with pulling the functions out of _SpecMethods (and
dropping the class) but I'd prefer the distinct functions continue to
exist as they are.  Also, I still think updating the ModuleType
signature is the way to go (given current use cases). :)

 First, about breaking up _SpecMethods: that was entirely on purpose. =) ... 
 IOW _SpecMethods feels like OOP just 'cause and not for any design reasons; 
 it's been making my eye twitch when I look at that class.

Keep in mind that _SpecMethods is basically a proxy for ModuleSpec
that has the methods that ModuleSpec had originally.  That was the
simplest way to not expose the methods on every module.__spec__.  If
we didn't care about exposing more API on __spec__, we'd have it all
on ModuleSpec.  I still wonder if we could have used subclassing
instead of proxying (obviating the pain points we've run into) and
used a SimpleModuleSpec for __spec__ and ModuleSpec for all other APIs
(or ModuleSpec/FullModuleSpec):

  SimpleModuleSpec  # What currently is ModuleSpec.
  ModuleSpec(SimpleModuleSpec)  # Basically this is _SpecMethods.

Regardless,  _SpecMethods made sense at the time and I still find it
helpful to have the functions grouped into a distinct namespace.  That
said, I agree that it's a pain. :)  I'm okay with ditching the class,
but would rather we kept the distinct functions that exist now.

 Second, the dance that an advanced user has to worry about is does 
 create_module exist, and if so did it not return None and if any of that is 
 not true then return what types.ModuleType would give you is not exactly one 
 line of code ATM. There is no reason to not abstract that out to do the right 
 thing in the face of a loader.

That's what _SpecMethods.create() already does for you.

 Third, yes this would be to encourage people not to directly call 
 types.ModuleType but call the utility function instead.

I'm totally on board. :)

 Fourth, I purposefully didn't bifurcate the code of types.ModuleType based on 
 the type of what the first argument was. At best you could change it to take 
 an optional spec as a second argument and use that, but if you did that and 
 the name doesn't match the spec then what?

I see your point.  I just see the trade-offs a little differently. :)
This is all about finding the best way of eliminating the problem of
people not setting the module attributes properly (and making it
easier to do so).  From my perspective:

* Currently every module must have a spec (and consequently a loader).
* Updating the ModuleType signature will encourage setting the spec,
etc. better than a separate factory would.

If every module must have a spec, then I'd expect that to be part of
the ModuleType signature.  I can see the use case (though uncommon)
for directly creating a module object.  Is there a use case for
creating a module without a spec?  Either way, if it's important
enough to ensure that people set the module attrs properly, then we
should consider having direct instantiation of ModuleType() issue a
warning when created without setting the spec, etc.

Regarding the second point, with a separate factory function, people
will have to learn about the function and then switch to using it
before they get the benefit.

Backward compatibility for an updated signature shouldn't be too hard:

  currently: ModuleType(name, doc=None)
  updated: ModuleType(name_or_spec, doc=None, *, loader=None)
  actual: ModuleType(name_or_spec=None, /, name=None, doc=None, *, loader=None)

 I'm not going to promote passing in a loader because spec_from_loader() 
 cannot necessarily glean all of the same information a hand-crafted spec 
 could if the loader doesn't have every possible introspection method defined 
 (I'm calling explicit is better than implicit to back that up).

Regardless of new signature or new factory, I still think the
signature should allow for passing in a spec or passing in a
name/loader pair.  Passing name/loader instead of spec is a
convenience for what I anticipate is the most common use case now:
given a loader, create a new module.  For comparison:

  mod = new_module(name, loader=loader)

vs.

  spec = spec_from_loader(name, loader=loader)
  mod = new_module(spec)

I'll argue that we can accommodate the common case and if that doesn't
work, they can still create their own spec.  If this were new
functionality then I'd agree with you.

 I also don't think any type should depend on importlib having been previously 
 loaded to properly function if it isn't strictly required, so the code would 
 have to be written entirely in C which I just don't want to write. =)

If it's in _bootstrap then it's already available.  No C required. :)

 Since it's going beyond simply constructing a new module but also 
 initializing it I think it's fine to keeping it in importlib.util which also 
 makes it all more discoverable for people than having to realize that 
 types.ModuleType is the place to go to 

[issue21235] importlib's spec module create algorithm is not exposed

2014-05-26 Thread Eric Snow

Eric Snow added the comment:

I'm just considering current usage:

  mod = loader.load_module(name)

becomes:

  spec = spec_from_loader(name, loader)
  mod = load(spec)

vs.

  mod = load(name, loader=loader)

I guess I'm torn.  I like how the former forces you to consider specs when 
dealing with the import system.  On the other hand, I don't want it to be 
annoying to have to move to this brave new world (that's exactly why we toned 
down the deprecations).  And on the third hand, perhaps it would be annoying to 
just a handful of people so we shouldn't sweat it.

So if we end up simplifying, load() could look like this:

def load(spec):  # or load_from_spec
return _SpecMethods(spec).load()

It already takes care of everything we need, including the import lock stuff.

--

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



[issue20383] Add a keyword-only spec argument to types.ModuleType

2014-05-26 Thread Brett Cannon

Brett Cannon added the comment:

I think we view the fundamentals of built-in types differently as well. =) A 
module instance can exist without a spec no problem. As long as you don't pass 
that module instance through some chunk of code that expects __spec__ -- or any 
other attribute for that matter -- then the instance is fine and operates as 
expected. There is nothing fundamental to module objects which dictates any 
real attribute is set (not even __name__). If I wanted to construct a module 
from scratch and just wanted a blank module object which I assign attributes to 
manually then I can do that, and that's what types.ModuleType provides (sans 
its module name requirement in its constructor which really isn't necessary 
either).

This also means that tying the functionality of the module type to importlib is 
the wrong direction to have the dependency. That means I refuse to add code to 
the module type which requires that importlib have been imported and set up. 
Just think of someone who embeds Python and has no use for imports; why should 
the module type then be broken because of that choice? That means anything done 
to the module type needs to be done entirely in C.

But luckily for you bytes broke the glass ceiling of pivoting on a type's 
constructor based on its input type (it is the only one, though). So I'll let 
go on arguing that one. =)

Anyway, I'll think about changing types.ModuleType, but having to implement 
init_module_attrs() in pure C and then exposing it in _imp just doesn't sound 
like much fun.

And as for your preference that the distinct functions continue to exist as 
they are, are you saying you want the code duplicated or that you just don't 
like me merging the create() and init_module_attrs() functions?

--

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



[issue3015] tkinter with wantobjects=False has been broken for some time

2014-05-26 Thread Jessica McKellar

Jessica McKellar added the comment:

@Lita.Cho: (I'd like to this on the web but the links are still broken after 
the website port) if you search for `wantobjects` in `Doc/whatsnew/2.3.rst`, 
there's a description of why the parameter was added.

--

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



[issue21563] Segv during call to builtin_execfile in application embedding Python interpreter.

2014-05-26 Thread Robert Snoeberger

Robert Snoeberger added the comment:

I created a patch to add a check for NULL globals or locals. The file 
execfile.patch is attached. A system error is set with the message globals and 
locals cannot be NULL if either is NULL.

An open question I have is how should I create tests for this patch? I verified 
that the crash doesn't occur when I run the attached execfile_invoke.c program.

--
keywords: +patch
Added file: http://bugs.python.org/file35372/execfile.patch

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



[issue20383] Add a keyword-only spec argument to types.ModuleType

2014-05-26 Thread Eric Snow

Eric Snow added the comment:

I give. :)  You've made good points about builtins and C implementations.  
Also, thinking about issue #21235 has changed my perspective a bit.

As to _SpecMethods, I mean just drop the class and turn the methods into 
functions:

* name: name - _spec_name (or whatever)
* signature: self - spec
* body: self.spec - spec
* body: self.method - method (there is interplay between methods)

And then importlib.util.new_module:

def new_module(spec):
return _bootstrap._spec_create(spec)

--

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



[issue21584] Unraised overflow error in sqlite3.Row indexing

2014-05-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

When integer index overflows C long, sqlite3.Row.__getitem__() doesn't raise an 
exception. Instead overflow exception is raised later.

 import sqlite3
 con = sqlite3.connect(:memory:)
 con.row_factory = sqlite3.Row
 row = con.execute(select 1 as a, 2 as b).fetchone()
 row[2**1000]
2
 
OverflowError: Python int too large to convert to C long

--
assignee: serhiy.storchaka
components: Extension Modules
keywords: easy
messages: 219174
nosy: Claudiu.Popa, ghaering, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Unraised overflow error in sqlite3.Row indexing
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue21584] Unraised overflow error in sqlite3.Row indexing

2014-05-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Actually this happens after applying the patch from issue10203.

--
resolution:  - not a bug
status: open - closed

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



[issue10203] sqlite3.Row doesn't support sequence protocol

2014-05-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Looks good, but there is one detail. Whith issue10203.patch when integer index 
overflows C long, sqlite3.Row.__getitem__() doesn't raise an exception. Instead 
overflow exception is raised later.

 import sqlite3
 con = sqlite3.connect(:memory:)
 con.row_factory = sqlite3.Row
 row = con.execute(select 1 as a, 2 as b).fetchone()
 row[2**1000]
2
 
OverflowError: Python int too large to convert to C long

--
assignee:  - serhiy.storchaka

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



[issue3015] tkinter with wantobjects=False has been broken for some time

2014-05-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Now I think we shouldn't deprecate and remove wantobjects=False. Tkinter was 
partially broken with wantobjects=False, on other hand, it was partially broken 
with wantobjects=True. Many bugs was fixed last months, all tests now work with 
wantobjects=False, and I hope Tkinter now correctly supports both mode.

Besides using in old third-party code, this parameter is very helpful for 
testing. Tcl/Tk changes internal details from release to release, so when in 
one release Tk function returns list or integer, in other release it can return 
special object ('dict' or 'pixel'). Tkinter should be more stable against 
changing of return type, and wantobjects=False helps in detecting some such 
cases.

I propose to close this issue as fixed.

--

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



[issue21585] Run Tkinter tests with wantobjects=False

2014-05-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

The wantobjects attribute of the tkinter module is True by default, and all 
Tkinter tests run with wantobjects=True. We need to test Tkinter with 
wantobjects=False too. All Tkinter tests should be ran twice, in both mode.

--
components: Tests, Tkinter
messages: 219178
nosy: gpolo, serhiy.storchaka, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Run Tkinter tests with wantobjects=False
type: enhancement
versions: Python 3.5

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



[issue10203] sqlite3.Row doesn't support sequence protocol

2014-05-26 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Thanks. Here's a fix.

--
Added file: http://bugs.python.org/file35373/issue10203_1.patch

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



[issue21505] cx_freeze multiprocessing bug

2014-05-26 Thread Torsten Landschoff

Torsten Landschoff added the comment:

That sounds like you did not initialize the freeze support of the 
multiprocessing module:

https://docs.python.org/3/library/multiprocessing.html#multiprocessing.freeze_support

Basically, you need to add the following code to your main, before anything 
else:

from multiprocessing import freeze_support
freeze_support()

Interestingly, the documentation states that starting a new Process instance 
without freeze_support will raise a RuntimeError. Maybe the detection of that 
situation failed in your case?

--
nosy: +torsten

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



[issue21536] extension built with a shared python cannot be loaded with a static python

2014-05-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 PHP might be close to our case: Debian includes a libphp5.so
 (in /usr/lib/php5), yet neither /usr/bin/php5 nor the Apache libphp5.so 
 link against it, and all the PHP modules (in 
 /usr/lib/php5/20100525+lfs/) don't link with the shared library -
 on Debian. I wonder how it is on systems that actually use the PHP 
 shared library.

Regardless of libphp5.so, the modules in /usr/lib/php5/20100525 don't link 
against /usr/lib/apache2/modules/libphp5.so, though the latter is obviously 
able to load those modules.

--

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



[issue21586] Minor error How To Sockets

2014-05-26 Thread Daniel Fisher

New submission from Daniel Fisher:

There is a minor error in the documentation page 
https://docs.python.org/2/howto/sockets.html;

Line 31 of the sample program of the program listed under Using a Socket 
reads chucks.append(chunk). It should read chunks.append(chunk). Without this 
minor correction, the sample program will not run.

--
assignee: docs@python
components: Documentation
messages: 219182
nosy: Daniel.Fisher, docs@python
priority: normal
severity: normal
status: open
title: Minor error How To Sockets
versions: Python 2.7

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



[issue21587] Tabs in source

2014-05-26 Thread Joshua Landau

New submission from Joshua Landau:

There are tabs in the source:

http://hg.python.org/cpython/file/5c8d71516235/Include/listobject.h#l49

I don't really know, but this seems like a release blocker to me ;).

--
messages: 219183
nosy: Joshua.Landau
priority: normal
severity: normal
status: open
title: Tabs in source

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



[issue21586] Minor error How To Sockets

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dc2a123d538a by Benjamin Peterson in branch '2.7':
fix typo in variable name (closes #21586)
http://hg.python.org/cpython/rev/dc2a123d538a

New changeset 62eb4828fdf7 by Benjamin Peterson in branch '3.4':
fix typo in variable name (closes #21586)
http://hg.python.org/cpython/rev/62eb4828fdf7

New changeset 487e8e071551 by Benjamin Peterson in branch 'default':
merge 3.4 (#21586)
http://hg.python.org/cpython/rev/487e8e071551

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue21587] Tabs in source

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e38e30b0d017 by Benjamin Peterson in branch '2.7':
remove tab (closes #21587)
http://hg.python.org/cpython/rev/e38e30b0d017

New changeset f7075eb04b75 by Benjamin Peterson in branch '3.4':
remove tab (closes #21587)
http://hg.python.org/cpython/rev/f7075eb04b75

New changeset 37166903007e by Benjamin Peterson in branch 'default':
merge 3.4 (#21587)
http://hg.python.org/cpython/rev/37166903007e

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue21536] extension built with a shared python cannot be loaded with a static python

2014-05-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Hmm, apparently the -l flag was added in #832799, for a rather complicated case 
where the interpreter is linked with a library dlopened by an embedding 
application (I suppose for some kind of plugin system). The OP there also 
mentions RTLD_GLOBAL as a workaround (or perhaps the right way of achieving the 
desired effect).

(also, the OP didn't mention why he used a shared library build, instead of 
linking Python statically with the dlopened library)

--

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



[issue21434] python -3 documentation is outdated

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ae2e8bfda7d7 by Benjamin Peterson in branch '2.7':
remove list of example incompatibilities (closes #21434)
http://hg.python.org/cpython/rev/ae2e8bfda7d7

--
nosy: +python-dev
resolution:  - fixed
stage: commit review - resolved
status: open - closed

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



[issue21304] PEP 466: Backport hashlib.pbkdf2_hmac to Python 2.7

2014-05-26 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Looks like there's a debugging turd in the test.

--

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



[issue21581] Consider dropping importlib.abc.Loader.create_module()

2014-05-26 Thread Nick Coghlan

Nick Coghlan added the comment:

I suggest waiting until we update the C extension import system before making a 
final decision - that was the concrete use case for the feature, so it may 
become less confusing once that is added.

--
nosy: +ncoghlan

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



[issue21581] Consider dropping importlib.abc.Loader.create_module()

2014-05-26 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue21477] Idle: improve idle_test.htest

2014-05-26 Thread Ned Deily

Ned Deily added the comment:

2. Htest's for GrepDialog, outputwindow, configDialog and Filelist are not 
progressing because of assert statements in macosxsupport.py.

The asserts are to ensure that none of the Tk-variant tests (isCarbonTk(), 
isCocoaTk(), et al) are called before _initializeTkVariantTests(root) has been 
called.  And _initializeTkVariantTests can only be called after the initial 
calls to Tk have been made to create an initial window environment; it's only 
at that point that we can call Tk to enquire what variant of Tk we are running 
under (macosxSupport.py:28 and 33).  _initializeTkVariantTests is called from 
macosxSupport.setupApp which is called from PyShell.main.  This is fine for 
normal IDLE startup but it doesn't take into account the module level tests.  
Ideally, you do want to have run _initializeTkVariantTests before running GUI 
tests so that the behavior is properly conditioned on Tk variant type, so 
stubbing out the Tk type with macosxsupport._tk_type = other' is not 
desirable.  Perhaps the best way to deal with it is to create a common GUI test 
initialization function that is called by all of the GUI tests; the initializ
 ation function would be responsible for creating the Tk() root, calling 
_initializeTkVariantTests, and any other common steps that might arise.

--
nosy: +ned.deily

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2014-05-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
versions: +Python 3.5 -Python 3.4

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2014-05-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


Added file: http://bugs.python.org/file35374/keymerge.diff

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



[issue21467] IDLE icon not included in Windows installer

2014-05-26 Thread R. David Murray

R. David Murray added the comment:

Issue number was mistyped in commit message.  Commit was 730eeb10cd81.

--
nosy: +r.david.murray

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



[issue21575] list.sort() should show arguments in tutorial

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1b96949bfc97 by Raymond Hettinger in branch 'default':
Issue 21575:  Show list.sort() arguments in the tutorial.
http://hg.python.org/cpython/rev/1b96949bfc97

--
nosy: +python-dev

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



[issue21468] NNTPLib connections become corrupt after long periods of activity

2014-05-26 Thread R. David Murray

R. David Murray added the comment:

This is likely to be hard to reproduce (but perhaps someone will try). The best 
hope of getting it fixed is probably for you to investigate it yourself. 

Were you using ssl?  Also, have you tried all the python versions you selected, 
and if so, which exact versions?

--
nosy: +r.david.murray

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



[issue21575] list.sort() should show arguments in tutorial

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset be77b213ace0 by Raymond Hettinger in branch '2.7':
Issue 21575:  Show list.sort() arguments in the tutorial.
http://hg.python.org/cpython/rev/be77b213ace0

--

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



[issue21575] list.sort() should show arguments in tutorial

2014-05-26 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - fixed
status: open - closed

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



[issue17390] display python version on idle title bar

2014-05-26 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I taught a python class this week with Python 2.7.7 and the learners found this 
change to be an impediment to usability.

The filename and fullpath are the most important pieces of information in the 
title bar.   They are now obscured by the version information which is somewhat 
unimportant (it has already been shown in the shell window and it is uncommon 
to run multiple versions of python using IDLE at the same time).

Looking to Microsoft Excel and Word as comparative examples, they only show the 
document name.

I conclude that this change should be reverted.  For the time being, I can't 
continue to use IDLE in 2.7.7 to teach with.  Not seeing the filename is 
especially important when many small windows are open (as they usually are 
during tdd and pdb sessions).

--
nosy: +rhettinger
priority: normal - high

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



[issue16638] support multi-line docstring signatures in IDLE calltips

2014-05-26 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Using Python 2.7.7 is a classroom setting revealed that this change is 
sometimes helpful and sometimes problematic.

The big tip windows are VERY distracting during live coding demos and learners 
are reporting that it breaks their concentration.  On the other hand, it is 
nice when a function is being encountered for the first time.

I recommend providing a way to turn this feature off or limit it to displaying 
a given function in full no more than once.

--
nosy: +rhettinger
priority: normal - high
status: closed - open

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



[issue21304] PEP 466: Backport hashlib.pbkdf2_hmac to Python 2.7

2014-05-26 Thread Alex Gaynor

Alex Gaynor added the comment:

New patch removes the pdb nonsense in the test.

--
Added file: http://bugs.python.org/file35375/pbkdf2.diff

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



[issue21588] Idle: make editor title bar user configurable

2014-05-26 Thread Terry J. Reedy

New submission from Terry J. Reedy:

#17390 changes the title bars for (so far), shell and editor windows. While the 
editor window change helps me (for reasons given on the issue) and got no 
objection, before being pushed, from people nosy on the issue, others have 
found it objectionable in practice. Since no one solution satisfies all use 
cases, I propose to make the editor_title format user configurable. Since extra 
keywords are ignored, as in
   {short}.format(short='abc', long='xyz')
  'abc'
users can omit and arrange fields as they please in editor_title, which would 
then be called with all 3 variable field values. 
  editor_title.format(short=short, long=long, version=version)
I believe editor_title = '{short} - {long}' produces the previous title. That 
can be the default.

A complication is that EditorWindow is also the base window class for Shell and 
Output windows. The title is calculated and set in a generic
 def saved_change_hook(self):  # line 921 in 3.3
However, I believe that having non-empty short and long names is unique to 
editor windows (must recheck). If so. the format call could go in the second 
line of 
 if short and long:
   title = short +  -  + long
If untitled files were given a 'long' title of '(no file)', then they would be 
handled by the same clause. Explaining why a window is 'untitled' (no file to 
title it from) might be a benefit anyway.

Some other possible solutions: Add parameter editor=False to saved_change_hook. 
Make EditorWindow a subclass of a generic Base Editor and move things specific 
to EditorWindow to the subclass.

--
assignee: terry.reedy
messages: 219198
nosy: terry.reedy
priority: high
severity: normal
stage: needs patch
status: open
title: Idle: make editor title bar user configurable
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5

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



[issue21588] Idle: make editor title bar user configurable

2014-05-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Another possibility is to separate the calculation of the title from setting 
it. This would make it much easier to unittest the calculation of the title.

--

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



[issue17390] display python version on idle title bar

2014-05-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Since no title format can satisfy everyone, I propose to make it user 
configurable. The default can be the old style. I opened #21588 for that and 
marked it high priority.

--
priority: high - normal
versions: +Python 3.5 -Python 3.3

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



[issue21439] Numerous minor issues in Language Reference

2014-05-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 053ba3c2c190 by Raymond Hettinger in branch '3.4':
Issue 21439:  Minor issues in the reference manual.
http://hg.python.org/cpython/rev/053ba3c2c190

--
nosy: +python-dev

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



[issue21439] Numerous minor issues in Language Reference

2014-05-26 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Most of the comments ended-up being useful and we applied.

--
resolution:  - fixed
status: open - closed
versions: +Python 3.4

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



[issue19903] Idle: Use inspect.signature for calltips

2014-05-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

My understanding is that when a builtin is converted, a) the docstring 
signature disappears, and b) getfullargspec calls str(signature). I need to 
check what now happens with .getfullargspec version .signature for uncoverted 
builtins and if any changes should be made now.

--

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