Re: Working with XML/XSD

2013-08-07 Thread dieter
David Barroso dbarro...@dravetech.com writes: I was wondering if someone could point me in the right direction. I would like to develop some scripts to manage Cisco routers and switches using XML. However, I am not sure where to start. Does someone have some experience working with XML,

Re: Reg secure python environment with web terminal emulator

2013-08-07 Thread dieter
Lakshmipathi.G lakshmipath...@gmail.com writes: We have a server running a web-based terminal emulator (based on shellinabox for screen-casting check www.webminal.org) that allows users to learn simple bash commands. This Linux environment secured by things like quota, selinux,ulimit etc

Re: new to While statements

2013-08-07 Thread krismesenbrink
wow everyone thanks for the feed back! i'll have to rewrite this with everything you guys taught me. this makes ALOT more sense. :D -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 6 August 2013 20:42, Luca Cerone luca.cer...@gmail.com wrote: Hi Chris, thanks Do you ever instantiate any A() objects? You're attempting to call an unbound method without passing it a 'self'. I have tried a lot of variations, instantiating the object, creating lambda functions that

Re: Enum vs OrderedEnum

2013-08-07 Thread Ian Kelly
On Tue, Aug 6, 2013 at 7:55 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Ian Kelly ian.g.ke...@gmail.com writes: Terrain that is “radiated” would be terrain that has some kind of spokes spreading out from its centre. I think you mean “irradiated”. Hope the game goes well :-) It's

Re: pexpect, loading an entry field

2013-08-07 Thread Lakshmipathi.G
Hi - I'm using Python 2.7.3 (Fedora 17) . I tried a simple example with pexpect to copy a file to remote system. It works $ cat pex.py import pexpect s = pexpect.spawn ('scp pex.py root@10.30.77.244:/tmp') s.expect ('Password:') s.sendline ('a') s.expect(pexpect.EOF,timeout=20) Execute above

Re: Working with XML/XSD

2013-08-07 Thread David Barroso
I will start looking to the links and libraries you pointed out. As the schema definitions are provided by the vendor I think I will go for PyXB. Thanks! On Wed, Aug 7, 2013 at 8:00 AM, dieter die...@handshake.de wrote: David Barroso dbarro...@dravetech.com writes: I was wondering if

Re: Enum vs OrderedEnum

2013-08-07 Thread Ian Kelly
On Tue, Aug 6, 2013 at 6:33 PM, Ethan Furman et...@stoneleaf.us wrote: class Environment(AutoNumber): gaia = 2.0 fertile = 1.5 terran = 1.0 jungle = 1.0 ocean = 1.0 arid = 1.0 steppe = 1.0 desert = 1.0 minimal = 1.0 barren = 0.5 tundra = 0.5

beginner question (True False help)

2013-08-07 Thread eschneider92
I'm trying to create an option for the program to repeat if the user types 'y' or 'yes', using true and false values, or otherwise end the program. If anyone could explain to me how to get this code working, I'd appreciate it. letters='abcdefghijklmn' batman=True def thingy(): print('type

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Luca Cerone
Hi Joshua thanks! I think you might not understand what Chris said. Currently this does *not* work with Python 2.7 as you suggested it would. op = map(A.fun,l) Yeah actually that wouldn't work even in Python 3, since value attribute used by fun has not been set. It was my mistake in the

Re: beginner question (True False help)

2013-08-07 Thread Joshua Landau
On 7 August 2013 09:17, eschneide...@comcast.net wrote: I'm trying to create an option for the program to repeat if the user types 'y' or 'yes', using true and false values, or otherwise end the program. If anyone could explain to me how to get this code working, I'd appreciate it. Always

Resuming the HTTP Download of a File and HTTP compression

2013-08-07 Thread iMath
the file I want to download is 100 bytes uncompressed, the downloads was interrupted when 5000 bytes compressed data was transmitted .If I want to Resuming the HTTP Download ,I wonder what value of the HTTP Range header should be ,“bytes=5000-“ or “bytes= os.path.getsize(downloadedPart)-”?

Resuming the HTTP Download of a File and HTTP compression

2013-08-07 Thread iMath
the file I want to download is 100 bytes uncompressed, the downloads was interrupted when 5000 bytes compressed data was transmitted .If I want to Resuming the HTTP Download ,I wonder what value of the HTTP Range header should be ,“bytes=5000-“ or “bytes= os.path.getsize(downloadedPart)-”?

Re: Reg secure python environment with web terminal emulator

2013-08-07 Thread Lakshmipathi.G
Hi - Thanks for the response. Yes, we used OS features to restrict the system user accounts. We don't allow gcc - this helped us to avoid kernel exploits via C code like : https://www.centos.org/modules/newbb/viewtopic.php?viewmode=flattopic_id=42827forum=59

Re: Bug? ( () == [] ) != ( ().__eq__([]) )

2013-08-07 Thread Shiyao Ma
Sorry. I don't quite get it. As you said, it first tries, leftOperand.__eq__(rightOperand) then if it returns NotImplemented, it goes to invoke rightOperand.__eq__(leftOperand). But for any reason, [] == () returns false, why? On Mon, Aug 5, 2013 at 7:06 AM, Chris Angelico ros...@gmail.com

Re: Bug? ( () == [] ) != ( ().__eq__([]) )

2013-08-07 Thread Chris Angelico
On Wed, Aug 7, 2013 at 10:24 AM, Shiyao Ma i...@introo.me wrote: Sorry. I don't quite get it. As you said, it first tries, leftOperand.__eq__(rightOperand) then if it returns NotImplemented, it goes to invoke rightOperand.__eq__(leftOperand). But for any reason, [] == () returns false, why?

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 7 August 2013 09:33, Luca Cerone luca.cer...@gmail.com wrote: To correct my example: from multiprocessing import Pool class A(object): def __init__(self,x): self.value = x def fun(self,x): return self.value**x l = range(100) p = Pool(4) op = p.map(A(3).fun,

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Luca Cerone
doesn't work neither in Python 2.7, nor 3.2 (by the way I can't use Python 3 for my application). Are you using Windows? Over here on 3.3 on Linux it does. Not on 2.7 though. No I am using Ubuntu (12.04, 64 bit).. maybe things changed from 3.2 to 3.3? from multiprocessing import Pool

Re: lxml tostring quoting too much

2013-08-07 Thread andrea crotti
2013/8/6 Chris Down ch...@chrisdown.name: On 2013-08-06 18:38, andrea crotti wrote: I would really like to do the following: from lxml import etree as ET from lxml.builder import E url = http://something?x=10y=20; l = E.link(url) ET.tostring(l) - linkhttp://something?x=10y=20/link

Re: Can someone suggest better resources for learning sqlite3? I wanted to use the Python library but I don't know sql.

2013-08-07 Thread Skip Montanaro
Can someone suggest me better resources for learning sql/sqlite3? The concepts behind the Structured Query Language haven't changed much since Edgar Codd first developed them in the 1970s. (He received the Turing Award in 1981 for this work.) Building and querying databases is very easy to do

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 7 August 2013 11:10, Luca Cerone luca.cer...@gmail.com wrote: I can't try it now, I'll let you know later if it works! (Though just by reading I can't really understand what the code does). Well, from multiprocessing import Pool from functools import partial class A(object): def

Re: Enum vs OrderedEnum

2013-08-07 Thread Neil Cerutti
On 2013-08-07, Ian Kelly ian.g.ke...@gmail.com wrote: On Tue, Aug 6, 2013 at 7:55 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Ian Kelly ian.g.ke...@gmail.com writes: Terrain that is ?radiated? would be terrain that has some kind of spokes spreading out from its centre. I think you mean

Mock pathc question

2013-08-07 Thread balderman
Hi I would like to mock patch the attribute 'calc' in the 'Client' class (See code below). I have 2 unit tests: 1) test1 - that patch an existing instance of 'Client' - it works fine. 1) test2 - that tries to patch the 'Client' class. My expectation is that after the patching, every instance

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Peter Otten
Joshua Landau wrote: On 7 August 2013 11:10, Luca Cerone luca.cer...@gmail.com wrote: I can't try it now, I'll let you know later if it works! (Though just by reading I can't really understand what the code does). Well, from multiprocessing import Pool from functools import partial

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 7 August 2013 15:46, Peter Otten __pete...@web.de wrote: import copy_reg import multiprocessing import new new is deprecated from 2.6+; use types.MethodType instead of new.instancemethod. def make_instancemethod(inst, methodname): return getattr(inst, methodname) This is just

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Peter Otten
Joshua Landau wrote: On 7 August 2013 15:46, Peter Otten __pete...@web.de wrote: def make_instancemethod(inst, methodname): return getattr(inst, methodname) This is just getattr -- you can replace the two uses of make_instancemethod with getattr and delete this ;). D'oh ;) --

Re: HTTP post with urllib2

2013-08-07 Thread cerr
On Tuesday, August 6, 2013 5:14:48 PM UTC-7, MRAB wrote: On 06/08/2013 23:52, cerr wrote: Hi, Why does this code: #!/usr/bin/python import urllib2 from binascii import hexlify, unhexlify host = localhost uri=/test.php data

Re: make elements of a list twice or more.

2013-08-07 Thread liuerfire Wang
I got it! It can do like [i for i in x for y in range(2)] On Wed, Aug 7, 2013 at 4:50 PM, liuerfire Wang liuerf...@gmail.com wrote: Sorry for the title which didn't make clear. Here is a list x = [b, a, c] (a, b, c are elements of x. Each of them are different type). Now I wanna generate a

Re: Creating a running tally/ definitely new to this

2013-08-07 Thread Joshua Landau
On 6 August 2013 16:24, gratedme...@gmail.com wrote: On Monday, August 5, 2013 10:15:30 PM UTC-4, Dave Angel wrote: gratedme...@gmail.com wrote: I currently working on a game, where I need to maintain a running tally of money, as the player makes purchases as they navigate thru game. I

make elements of a list twice or more.

2013-08-07 Thread liuerfire Wang
Sorry for the title which didn't make clear. Here is a list x = [b, a, c] (a, b, c are elements of x. Each of them are different type). Now I wanna generate a new list as [b, b, a, a, c, c]. I know we can do like that: tmp = [] for i in x: tmp.append(i) tmp.append(i) However, I wander

Re: make elements of a list twice or more.

2013-08-07 Thread Peter Otten
liuerfire Wang wrote: Here is a list x = [b, a, c] (a, b, c are elements of x. Each of them are different type). Now I wanna generate a new list as [b, b, a, a, c, c]. I know we can do like that: tmp = [] for i in x: tmp.append(i) tmp.append(i) However, I wander is there a

Re: Can someone suggest better resources for learning sqlite3? I wanted to use the Python library but I don't know sql.

2013-08-07 Thread Skip Montanaro
I have one on my desk at work whose name I can't remember off the top of my head. I still refer to it from time-to-time. If you'd like a reference, let me know and I'll check on it at work. While I think of it: The Practical SQL Handbook; Using Structured Query Language, by Bowman, Emerson,

Re: Bug? ( () == [] ) != ( ().__eq__([]) )

2013-08-07 Thread Ethan Furman
On 08/07/2013 02:24 AM, Shiyao Ma wrote: Sorry. I don't quite get it. As you said, it first tries, leftOperand.__eq__(rightOperand) then if it returns NotImplemented, it goes to invoke rightOperand.__eq__(leftOperand). But for any reason, [] == () returns false, why? A list that is empty is

Re: Mock pathc question

2013-08-07 Thread Jean-Michel Pichavant
- Mail original - Hi I would like to mock patch the attribute 'calc' in the 'Client' class (See code below). I have 2 unit tests: 1) test1 - that patch an existing instance of 'Client' - it works fine. 1) test2 - that tries to patch the 'Client' class. My expectation is that

Re: new to While statements

2013-08-07 Thread Vito De Tullio
Dan Sommers wrote: while asking for reponse: while adventuring: that's a funny way to say `while True:`... Funny, perhaps, the first time you see it, but way more informative than the other way to the next one who comes along and reads it. While I understand that it's

Is a Metaclass the appropriate way to solve this problem?

2013-08-07 Thread Matthew Lefavor
All: Like most people, I find the whole metaclass topic pretty obscure, and I have avoided trying to use one for a while. I am also aware of Tim Peter's famous advice that if you have to ask whether you need a metaclass, then you almost certainly don't. But in this case I know I am solving a

Re: [tkinter] trouble running imported modules in main program

2013-08-07 Thread Cousin Stanley
Terry Reedy wrote: Code comments : double and triple spacing code make it painful to read, Not for everyone :-) I prefer mostly double-spaced code in any language especially in a 10 line box. Agree, but the 10 line box would not be used for routine

Re: Is a Metaclass the appropriate way to solve this problem?

2013-08-07 Thread Ian Kelly
On Wed, Aug 7, 2013 at 1:38 PM, Matthew Lefavor mclefa...@gmail.com wrote: I know that to create the DatabaseField objects I should be using a descriptor. But I also want the DataSet to automatically gain methods that will convert it into the expected JSON syntax (e.g., a __specifier__ method

Re: beginner question (True False help)

2013-08-07 Thread eschneider92
What I wanted to happen is when the user typed something other than 'y' or 'yes' after being asked 'go again?', the batman==False line would cause the program to stop asking anything and say 'this is the end'. Instead, what is happening is that the program just keeps going. I figured that after

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Luca Cerone
Thanks for the post. I actually don't know exactly what can and can't be pickles.. not what partialing a function means.. Maybe can you link me to some resources? I still can't understand all the details in your code :) -- http://mail.python.org/mailman/listinfo/python-list

Re: make elements of a list twice or more.

2013-08-07 Thread Joshua Landau
On 7 August 2013 17:59, Peter Otten __pete...@web.de wrote: liuerfire Wang wrote: Here is a list x = [b, a, c] (a, b, c are elements of x. Each of them are different type). Now I wanna generate a new list as [b, b, a, a, c, c]. I know we can do like that: tmp = [] for i in x:

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 7 August 2013 23:26, Luca Cerone luca.cer...@gmail.com wrote: Thanks for the post. I actually don't know exactly what can and can't be pickles.. I just try it and see what works ;). The general idea is that if it is module-level it can be pickled and if it is defined inside of something

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Luca Cerone
Thanks for the help Peter! def make_instancemethod(inst, methodname): return getattr(inst, methodname) This is just getattr -- you can replace the two uses of make_instancemethod with getattr and delete this ;). D'oh ;) --

Re: beginner question (True False help)

2013-08-07 Thread Dave Angel
eschneide...@comcast.net wrote: What I wanted to happen is when the user typed something other than 'y' or 'yes' after being asked 'go again?', the batman==False line would cause the program to stop asking anything and say 'this is the end'. Instead, what is happening is that the program

Re: new to While statements

2013-08-07 Thread Dave Angel
Vito De Tullio wrote: Dan Sommers wrote: while asking for reponse: while adventuring: that's a funny way to say `while True:`... Funny, perhaps, the first time you see it, but way more informative than the other way to the next one who comes along and reads it.

Re: make elements of a list twice or more.

2013-08-07 Thread liuerfire Wang
On Thu, Aug 8, 2013 at 6:18 AM, Joshua Landau jos...@landau.ws wrote: I'm actually posting to point out http://www.python.org/dev/peps/pep-0448/ would let you write: [*(item, item) for item in items] It seems like that it can be only used in python 3.4? I just use python 2.7 because of

Re: beginner question (True False help)

2013-08-07 Thread Larry Hudson
On 08/07/2013 01:17 AM, eschneide...@comcast.net wrote: I'm trying to create an option for the program to repeat if the user types 'y' or 'yes', using true and false values, or otherwise end the program. If anyone could explain to me how to get this code working, I'd appreciate it.

Re: outputting time in microseconds or milliseconds

2013-08-07 Thread matt . doolittle33
Taking a step back, you're probably better off using datetimes. You'll get all this conversion nonsense for free: i did: from time import strftime, time from datetime import datetime now = datetime.now() self.logfile.write('%s\t'%(strftime(%Y-%m-%d,)))

Re: new to While statements

2013-08-07 Thread Larry Hudson
On 08/06/2013 08:38 PM, krismesenbr...@gmail.com wrote: import random def room (): hp = 10 while hp != 0: random_Number = random.randint(1, 2) #asking if you want to roll/play des = input(Would you like to roll the die?) snip One very trivial

Re: Crawl Quora

2013-08-07 Thread David Hutto
Never tried this, but if it's not data you're after, but a search term type of app, then ip address crawl, and if keyword/metadata, then crawl, and parse, just as it seems you are doing, for keywords, and url's associated with them, then eliminate url's without that specified keyword parameter

Re: [tkinter] trouble running imported modules in main program

2013-08-07 Thread snakeinmyboot
if __name__ == '__main__': root = tkinter.Tk() app = MainClass(root) # 'MainClass' depends on the module. root.mainloop root.destroy for REAL you guys...wtf does this even mean lol. what is a boilerplate test code? -- http://mail.python.org/mailman/listinfo/python-list

Re: Reg secure python environment with web terminal emulator

2013-08-07 Thread Lakshmipathi.G
If you permit file I/O and anything that can spawn a process, it is possible to create a raw binary executable and trigger its execution. -- Yes,we permit file i/o with quota limits and spawning a process is allowed upto a limit. If I'm not wrong, we will be safe if user invokes

Re: Mock pathc question

2013-08-07 Thread Avishay Balderman
Hi 1) I prefer to use start/stop and not the decorator . 2) mock_play is the name of the module where the code belongs Thanks Avishay Sent from my iPhone On 7 באוג 2013, at 21:01, Jean-Michel Pichavant jeanmic...@sequans.com wrote: - Mail original - Hi I would like to mock patch the

Re: [tkinter] trouble running imported modules in main program

2013-08-07 Thread David
On 8 August 2013 14:06, snakeinmyboot mikelha...@gmail.com wrote: for REAL you guys...wtf does this even mean lol. what is a boilerplate test code? Did you try at all to find the answer to this yourself? I ask because it took me only a few seconds to go to wikipedia and search for

[issue1596321] KeyError at exit after 'import threading' in other thread

2013-08-07 Thread Thomas Guettler
Thomas Guettler added the comment: Only few people seem to use daemon threads. We do and see this problem often with Python 2.7. How difficult is it to get this fixed for 2.7? Is there a way to work around this problem? -- nosy: +guettli ___

[issue18674] Store weak references in modules_by_index

2013-08-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: It seems to me that the more appropriate change here would be to redefine PyState_FindModule as return a *new* ref rather than a borrowed ref and have it do the Py_INCREF before returning. Code using it would then need to add an appropriate Py_DECREF. A

[issue15787] PEP 3121 Refactoring

2013-08-07 Thread Alexander Belopolsky
Changes by Alexander Belopolsky alexander.belopol...@gmail.com: -- dependencies: +PEP 3121 Refactoring applied to _csv module ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15787 ___

[issue15787] PEP 3121 Refactoring

2013-08-07 Thread Alexander Belopolsky
Changes by Alexander Belopolsky alexander.belopol...@gmail.com: -- dependencies: +PEP 3121, 384 refactoring applied to curses_panel module ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15787

[issue15787] PEP 3121, 384 Refactoring

2013-08-07 Thread Alexander Belopolsky
Changes by Alexander Belopolsky alexander.belopol...@gmail.com: -- dependencies: +PEP 384 Refactoring applied to _csv module title: PEP 3121 Refactoring - PEP 3121, 384 Refactoring ___ Python tracker rep...@bugs.python.org

[issue15787] PEP 3121, 384 Refactoring

2013-08-07 Thread Alexander Belopolsky
Changes by Alexander Belopolsky alexander.belopol...@gmail.com: -- dependencies: +PEP 384 inconsistent with implementation ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15787 ___

[issue1856] shutdown (exit) can hang or segfault with daemon threads running

2013-08-07 Thread Thomas Guettler
Thomas Guettler added the comment: There are some examples to work around this for Python2: http://stackoverflow.com/questions/18098475/detect-interpreter-shut-down-in-daemon-thread -- nosy: +guettli ___ Python tracker rep...@bugs.python.org

[issue15787] PEP 3121, 384 Refactoring

2013-08-07 Thread Alexander Belopolsky
Changes by Alexander Belopolsky alexander.belopol...@gmail.com: -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15787 ___ ___

[issue15787] PEP 3121, 384 Refactoring

2013-08-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Regarding the suggestion of separating PEP3121 and PEP384. It might be true that datetime and other modules do not benefit directly from PEP 384, however it is still a fact that the stdlib modules should be seen as a set of reference modules, that are

[issue18675] Daemon Threads can seg fault

2013-08-07 Thread Thomas Guettler
New submission from Thomas Guettler: This is a documentation bug: Since #1856 is not solved for Python2, it needs to be documented. Daemon Threads on Python2 can seg fault. Work arounds: http://stackoverflow.com/questions/18098475/detect-interpreter-shut-down-in-daemon-thread --

[issue15787] PEP 3121, 384 Refactoring

2013-08-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: With respect to PEP 384 refactoring, I would like to see Tools/scripts/abitype.py used for most of the conversions. The PEP itself can probably be amended to advertise this tool more prominently. -- ___

[issue13153] IDLE crashes when pasting non-BMP unicode char on Py3

2013-08-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: u'\U000104a2' == u'\ud801\udca2' on narrow build. u'\ud801'.encode('utf-8', 'surrogatepass') == b'\xed\xa0\x81' u'\udca2'.encode('utf-8', 'surrogatepass') == b'\xed\xb2\xa2' Hope it will help. -- ___ Python

[issue18671] enhance formatting in logging package

2013-08-07 Thread M. Dietrich
M. Dietrich added the comment: for a logging library the important thing would be to not loose the information that was meant to log. as i said i do alot of long-running huge-data-processing scripts in py using the library. if the logging breaks but doesnt log what was intended to log i judge

[issue18668] Properly document setting m_size in PyModuleDef

2013-08-07 Thread Roundup Robot
Roundup Robot added the comment: New changeset 698fd628b001 by Eli Bendersky in branch '3.3': Issue #18668: Properly document setting m_size in PyModuleDef http://hg.python.org/cpython/rev/698fd628b001 New changeset 9877c25d9556 by Eli Bendersky in branch 'default': Closing #18668: Properly

[issue18668] Properly document setting m_size in PyModuleDef

2013-08-07 Thread Eli Bendersky
Eli Bendersky added the comment: Thanks for the review! -- resolution: fixed - stage: committed/rejected - needs patch status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18668

[issue18668] Properly document setting m_size in PyModuleDef

2013-08-07 Thread Eli Bendersky
Changes by Eli Bendersky eli...@gmail.com: -- resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18668 ___

[issue15651] PEP 3121, 384 refactoring applied to elementtree module

2013-08-07 Thread Eli Bendersky
Eli Bendersky added the comment: Antoine, some questions about the patch: First, I think it omits expat_capi from the state. Is that intentional? Second, I'm not sure if this approach is fully aligned with PEP 3121. A global, shared state is still used. Instead of actually having a different

[issue15651] PEP 3121, 384 refactoring applied to elementtree module

2013-08-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: First, I think it omits expat_capi from the state. Is that intentional? What would it do in the state? There's nothing to release. Second, I'm not sure if this approach is fully aligned with PEP 3121. A global, shared state is still used. Instead of

[issue18668] Properly document setting m_size in PyModuleDef

2013-08-07 Thread Nick Coghlan
Nick Coghlan added the comment: I thought setting m_size to zero was for No per module state, but reinitialization is fine? Does that not work? (I haven't actually tried it) -- ___ Python tracker rep...@bugs.python.org

[issue15651] PEP 3121, 384 refactoring applied to elementtree module

2013-08-07 Thread Eli Bendersky
Eli Bendersky added the comment: On Wed, Aug 7, 2013 at 6:28 AM, Antoine Pitrou rep...@bugs.python.orgwrote: Antoine Pitrou added the comment: First, I think it omits expat_capi from the state. Is that intentional? What would it do in the state? There's nothing to release. That's

[issue18676] Queue: zero should not be accepted as timeout value

2013-08-07 Thread Zhongyue Luo
New submission from Zhongyue Luo: The docstring of methods put() and get() in Queue.py states get(): If 'timeout' is a positive number, it blocks at most 'timeout' seconds and raises the Full exception if no free slot was available within that time. put(): If 'timeout' is a positive number,

[issue15651] PEP 3121, 384 refactoring applied to elementtree module

2013-08-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: That's true, but I thought one of the goals of PEP 3121 is to separate states between sub-interpreters. So that one can't corrupt another. I'm not sure how much it matters in practice in this case of the pyexpat capsule; need to look into it more.

[issue18676] Queue: document that zero is accepted as timeout value

2013-08-07 Thread R. David Murray
R. David Murray added the comment: This is more of a documentation issue than a code issue. To be mathematically precise, the text and error message should read a non-negative value. Alternatively the text and error could be changed to report that timeout may not be negative, which would

[issue18671] enhance formatting in logging package

2013-08-07 Thread Vinay Sajip
Vinay Sajip added the comment: From the line number you mentioned, it looks like you're talking about Python 2.7. However, Python 2.7 is closed to new features: generally speaking, only bug fixes are supposed to be committed to this branch. I can consider expanding the Logged from ... error

[issue18677] Enhanced context managers with ContextManagerExit and None

2013-08-07 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson: A proposed patch adds two features to context managers: 1)It has always irked me that it was impossible to assemble nested context managers in the python language. See issue #5251. The main problem, that exceptions in __enter__ cannot be properly

[issue11619] On Windows, don't encode filenames in the import machinery

2013-08-07 Thread Steven Velez
Steven Velez added the comment: This may be a small use case, but a use case none-the less. In my situation, I am distributing a frozen python package and it runs under the users home directory. If the user's name has international characters, this will fail. I expect we will have similar

[issue18677] Enhanced context managers with ContextManagerExit and None

2013-08-07 Thread R. David Murray
R. David Murray added the comment: Your use cases are either already addressed by contextlib.ExitStack, or should be addressed in the context of its existence. It is the replacement for contextlib.nested. -- nosy: +ncoghlan, r.david.murray ___

[issue18678] Wrong struct members name for spwd module

2013-08-07 Thread Vajrasky Kok
New submission from Vajrasky Kok: Both python2 and python3 have this behaviour. import os; os.getuid() 0 'I am root' 'I am root' import spwd spwd.getspnam('bin') spwd.struct_spwd(sp_nam='bin', sp_pwd='*', sp_lstchg=15558, sp_min=0, sp_max=9, sp_warn=7, sp_inact=-1, sp_expire=-1,

[issue18678] Wrong struct members name for spwd module

2013-08-07 Thread R. David Murray
R. David Murray added the comment: Ideally, for backward compatibility reasons we really ought to support access by the old (incorrect) name even in 3.4 (with a deprecation warning, even more ideally). I'm not sure if that's practical? -- nosy: +r.david.murray

[issue18677] Enhanced context managers with ContextManagerExit and None

2013-08-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: IMHO, exitstack is not a very nice construct. It's implementation is far longer than contextlib.nested. And the chief problem still remains, which has not been addressed until this patch (as far as I know): In Python, it is impossible to combine

[issue18677] Enhanced context managers with ContextManagerExit and None

2013-08-07 Thread R. David Murray
R. David Murray added the comment: Raising it on python-ideas sounds like a good idea, then. I must admit that I don't understand what you mean by combining existing context managers into a nested one that isn't addressed by ExitStack. -- ___

[issue11619] On Windows, don't encode filenames in the import machinery

2013-08-07 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11619 ___ ___ Python-bugs-list

[issue18677] Enhanced context managers with ContextManagerExit and None

2013-08-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Simply put, there is no way in the language to nest two context managers, even though we have full access to their implementation model, i.e. can call __enter__ and __exit__ manually. This reflects badly (pun intended) on Python's reflection and

[issue13153] IDLE crashes when pasting non-BMP unicode char on Py3

2013-08-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Seems as Tk stores pasted \U000104a2 as surrogate pair \ud801\udca2. Then it encoded in UTF-8 as \xed\xa0\x81\xed\xb2\xa2 end passed to Python. Python converts char* to Unicode object with PyUnicode_FromString() which forbids invalid UTF-8 including encoded

[issue18674] Store weak references in modules_by_index

2013-08-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: (and of course, with module states not being PyObjects, we have the same lifetimes issues as with Py_buffers not being PyObjects) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18674

[issue13153] IDLE crashes when pasting non-BMP unicode char on Py3

2013-08-07 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file31184/tkinter_string_conv.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13153 ___

[issue13153] IDLE crashes when pasting non-BMP unicode char on Py3

2013-08-07 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: Added file: http://bugs.python.org/file31185/tkinter_string_conv.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13153 ___

[issue18679] include a codec to handle escaping only control characters but not any others

2013-08-07 Thread Derek Wilson
New submission from Derek Wilson: Escaping strings for serialization or display is a common problem. Currently, in python3, in order to escape a sting, you need to do this: 'my\tstring'.encode('unicode_escape').decode('ascii') This would give you a string that was represented like this:

[issue18676] Queue: document that zero is accepted as timeout value

2013-08-07 Thread Zhongyue Luo
Zhongyue Luo added the comment: David, How about like below? elif timeout sys.float_info.epsilon: raise ValueError('timeout' must be a positive number) The docstring has been there for quite a while and IMHO it just doesn't make sense passing 0.0 as a timeout value. --

[issue8713] multiprocessing needs option to eschew fork() under Linux

2013-08-07 Thread Richard Oudkerk
Changes by Richard Oudkerk shibt...@gmail.com: Added file: http://bugs.python.org/file31186/b3620777f54c.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8713 ___

[issue8713] multiprocessing needs option to eschew fork() under Linux

2013-08-07 Thread Richard Oudkerk
Richard Oudkerk added the comment: I have done quite a bit of refactoring and added some extra tests. When I try using the forkserver start method on the OSX Tiger buildbot (the only OSX one available) I get errors. I have disabled the tests for OSX, but it seemed to be working before.

[issue18680] JSONDecoder should document that it raises a ValueError for malformed data

2013-08-07 Thread Corey Farwell
New submission from Corey Farwell: Before someone comes in and tries to correct me, I know Python documentation is different than Javadocs. It is common to test if the JSON is malformed using a try...catch. What if I want to catch something more specific than Exception? The only way a user

[issue18676] Queue: document that zero is accepted as timeout value

2013-08-07 Thread Richard Oudkerk
Richard Oudkerk added the comment: IMHO it just doesn't make sense passing 0.0 as a timeout value. I have written lots of code that looks like timeout = max(deadline - time.time(), 0) some_function(..., timeout=timeout) This makes perfect sense. Working code should not be broken --

[issue18680] JSONDecoder should document that it raises a ValueError for malformed data

2013-08-07 Thread Corey Farwell
Corey Farwell added the comment: Ideally, this would also be decoumented in json.loads/json.load -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18680 ___

[issue18679] include a codec to handle escaping only control characters but not any others

2013-08-07 Thread R. David Murray
R. David Murray added the comment: In what way does repr(x)[1:-1] not serve your use case? -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18679 ___

[issue18676] Queue: document that zero is accepted as timeout value

2013-08-07 Thread R. David Murray
R. David Murray added the comment: Exactly. 0 means Don't wait, just raise an error immediately if the queue is empty/full. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18676 ___

  1   2   >