Dan Mahn | 1 Mar 01:24 2009

Re: More on Py3K urllib -- urlencode()



Bill Janssen wrote:
Bill Janssen <janssen <at> parc.com> wrote:
Dan Mahn <dan.mahn <at> digidescorp.com> wrote:
3) Regarding the following code fragment in urlencode(): k = quote_plus(str(k)) if isinstance(v, str): v = quote_plus(v) l.append(k + '=' + v) elif isinstance(v, str): # is there a reasonable way to convert to ASCII? # encode generates a string, but "replace" or "ignore" # lose information and "strict" can raise UnicodeError v = quote_plus(v.encode("ASCII","replace")) l.append(k + '=' + v) I don't understand how the "elif" section is invoked, as it uses the same condition as the "if" section.
This looks like a 2->3 bug; clearly only the second branch should be used in Py3K. And that "replace" is also a bug; it should signal an error on encoding failures. It should probably catch UnicodeError and explain the problem, which is that only Latin-1 values can be passed in the query string. So the encode() to "ASCII" is also a mistake; it should be "ISO-8859-1", and the "replace" should be a "strict", I think.
Sorry! In 3.0.1, this whole thing boils down to l.append(quote_plus(k) + '=' + quote_plus(v)) Bill

Thanks.  Generally, I would tend to agree.  I actually tried something like that, but I found that I had inadvertently been sending numeric values, in which case the str() was saving me.  Considering that, I would rather just see something like ...

k = quote_plus(k) if isinstance(k,(str,bytes)) else quote_plus(str(k))
if isinstance(v,(str,bytes)):
    l.append(k + "=" + quote_plus(v))
else:
   # just keep what's in the else

I think it would be more compatible with existing code calling urlencode().  Additionally, I think it would be nice to allow selection of the quote_plus() string encoding parameters, but that was one of the other points I listed.

A similar thing could be done when "not doseq", but the handling of "v" would be exactly  like "k".

- Dan

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org
Heracles | 1 Mar 02:56 2009
Picon

Re: Patch Ready for review


Well, what got me interested in Python was the fact that it had support for
reading mail files and for the curses library.  When I found out there was a
need for folks to work on this module I thought I would start contributing,
I would love to become a primary maintainer of this particular module,
because I think writing console apps is cool (yes I know my inner nerd is
showing).

Maybe someday I will also create a computational geometry module that can be
plugged in to Python as well, but for the time being I think I could handle
working on this module.

&quot;Martin v. Löwis&quot; wrote:
> 
>> I am wondering what to expect next.  How long will it be before it is
>> applied etc.  This is my first attempt to submit a patch to Python.
> 
> Unfortunately, it may take any time between a day and five years, see
> below.
> 
>> Also, does anyone know who the main person is for running changes to the
>> curses library I wanted to get guidance for implementing support for
>> family
>> of functions newterm, set_term, reset_term.
> 
> The curses module is largely unmaintained; nobody is really responsible
> for it (my feeling is that it also has fairly few users). Use "svn log"
> to find out what people have been making changes over time; if the
> commit messages indicate that they had applied patches from the bug
> tracker, also try to recognize any regular non-commit contributors.
> 
> Regards,
> Martin
> _______________________________________________
> Python-Dev mailing list
> Python-Dev <at> python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
> 
> 

--

-- 
View this message in context: http://www.nabble.com/Patch-Ready-for-review-tp22254109p22269124.html
Sent from the Python - python-dev mailing list archive at Nabble.com.

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org
Hirokazu Yamamoto | 1 Mar 19:45 2009
Picon

Re: What type of object mmap.read_byte should return on py3k?

I uploaded the patch with choice (a)
http://bugs.python.org/file13215/py3k_mmap_and_bytes.patch
If (b) is suitable, I'll rewrite the patch.
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Armin Ronacher | 1 Mar 20:13 2009

PEP 372 -- Adding an ordered directory to collections ready for pronouncement

Hi everybody,

PEP 372 was modified so that it provides a simpler API (only the dict API
to be exact) and it was decided to start with a Python-only implementation
and replace it with a C version later if necessary.

Annotated changes from earlier versions of the PEP:

-   the extra API for ordered dict was dropped to keep the interface
    simple and clean.  Future versions can still be expanded but it's
    impossible to drop features later on.

-   To keep the implementation simple 3.1 / 2.7 will ship with a
    Python-only version of the class.  It can still be rewritten in
    C if it turns out to be too slow or thread safety is required.

The corresponding issue in the tracker: http://bugs.python.org/issue5397
Link to the PEP: http://www.python.org/dev/peps/pep-0372/

Anything else that should be done?

Regards,
Armin

_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Paul Moore | 1 Mar 21:58 2009
Picon

Re: draft 3.1 release schedule

2009/2/27 Benjamin Peterson <benjamin <at> python.org>:
> 2009/2/27 Nick Coghlan <ncoghlan <at> gmail.com> schrieb:
>>
>> I should have a PEP (and implementation) ready for alpha 2 to address
>> the current discrepancy between contextlib.nested and actual nested with
>> statements:
>> http://bugs.python.org/issue5251
>>
>> If you do add a reference to that bug report to the release PEP, mark
>> fixing it as a maybe though - with the associated PEP not even written
>> yet, I obviously still have some work to do to get the semantic change
>> approved by Guido and the rest of python-dev.
>
> Ok. I've added it.

Is it worth getting simplegeneric exposed in 3.1
(http://bugs.python.org/issue5135)? If it's going to be in 2.7, I'd
like to see it hit 3.1. The patch is against trunk (for 2.7) at the
moment, I'm not sure what the process would be for forward-porting it
(do I generate a new patch against the py3k branch, or should it be
applied to trunk and merged in?)

Paul.
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Nick Coghlan | 1 Mar 22:42 2009
Picon

Re: draft 3.1 release schedule

Paul Moore wrote:
> 2009/2/27 Benjamin Peterson <benjamin <at> python.org>:
>> 2009/2/27 Nick Coghlan <ncoghlan <at> gmail.com> schrieb:
>>> I should have a PEP (and implementation) ready for alpha 2 to address
>>> the current discrepancy between contextlib.nested and actual nested with
>>> statements:
>>> http://bugs.python.org/issue5251
>>>
>>> If you do add a reference to that bug report to the release PEP, mark
>>> fixing it as a maybe though - with the associated PEP not even written
>>> yet, I obviously still have some work to do to get the semantic change
>>> approved by Guido and the rest of python-dev.
>> Ok. I've added it.
> 
> Is it worth getting simplegeneric exposed in 3.1
> (http://bugs.python.org/issue5135)? If it's going to be in 2.7, I'd
> like to see it hit 3.1. The patch is against trunk (for 2.7) at the
> moment, I'm not sure what the process would be for forward-porting it
> (do I generate a new patch against the py3k branch, or should it be
> applied to trunk and merged in?)

As much as I'd like to get a simple generic implementation into
functools, the lack of support for ABCs still bothers me (despite my
last post about that on the tracker item). I'd be a -0 on it going in as
is, but if someone can figure out a clever way of supporting ABCs
without completing killing the invocation speed for generics, that would
go up to a +1.

(The current difficulty of this may actually reflect a more significant
limitation on the available metadata for ABCs in PEP 3119: it is easy to
ask "is this specific type an example of this ABC?", but difficult to
ask "which ABCs is this type as example of?". For actual inheritance,
the __mro__ attribute means that both questions are easy to answer, but
I'm not aware of any corresponding way of answering the latter question
for ABCs)

Cheers,
Nick.

P.S. I just unassigned myself from that tracker item - I'm going to have
my hands full working on the proposed change to the with statement.

--

-- 
Nick Coghlan   |   ncoghlan <at> gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Cesare Di Mauro | 1 Mar 23:04 2009

test_io fails on test_1686475

Running the test suite with Python 2.6.1 32 bit (compiled in DEBUG mode
with Visual Studio Express Edition 2008) on Vista x64, I've got an assert
error:

test_1686475 (__main__.StatAttributeTests) ... Assertion failed:
(__int64)(int)((in / 10000000) - secs_between_epochs) == ((in / 10000000)
- secs_between_epochs), file ..\Modules\posixmodule.c, line 790

I have no idea about this failure. Any hint?

Cheers,
Cesare
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Robert Collins | 1 Mar 23:43 2009
Picon

Re: test_io fails on test_1686475

On Sun, 2009-03-01 at 23:04 +0100, Cesare Di Mauro wrote:
> Running the test suite with Python 2.6.1 32 bit (compiled in DEBUG mode
> with Visual Studio Express Edition 2008) on Vista x64, I've got an assert
> error:
> 
> test_1686475 (__main__.StatAttributeTests) ... Assertion failed:
> (__int64)(int)((in / 10000000) - secs_between_epochs) == ((in / 10000000)
> - secs_between_epochs), file ..\Modules\posixmodule.c, line 790
> 
> I have no idea about this failure. Any hint?

[I haven't checked the test yet, let me know if my guess is wrong :)].
It looks to me that its asserting something to do with stat times; note
that windows has up to a 2 second granularity for stat times on files -
you may be hitting some code that assumes a sane file system :)

-Rob
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org
Amaury Forgeot d'Arc | 2 Mar 00:13 2009
Picon

Re: test_io fails on test_1686475

Hello,

On Sun, Mar 1, 2009 at 23:04, Cesare Di Mauro <cesare.dimauro <at> a-tono.com> wrote:
> Running the test suite with Python 2.6.1 32 bit (compiled in DEBUG mode
> with Visual Studio Express Edition 2008) on Vista x64, I've got an assert
> error:
>
> test_1686475 (__main__.StatAttributeTests) ... Assertion failed:
> (__int64)(int)((in / 10000000) - secs_between_epochs) == ((in / 10000000)
> - secs_between_epochs), file ..\Modules\posixmodule.c, line 790
>
> I have no idea about this failure. Any hint?

The failing assertion comes from this code in posixmodule.c:

	/* XXX Win32 supports time stamps past 2038; we currently don't */
	*time_out = Py_SAFE_DOWNCAST((in / 10000000) - secs_between_epochs,
__int64, int);

the test (btw, it's in test_os.py) is trying
    os.stat(r"c:\pagefile.sys")

Can you please check the three time stamps of this file (creation,
update, access)?

--

-- 
Amaury Forgeot d'Arc
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org

Benjamin Peterson | 2 Mar 02:23 2009

Re: draft 3.1 release schedule

2009/3/1 Paul Moore <p.f.moore <at> gmail.com>:
>
> Is it worth getting simplegeneric exposed in 3.1
> (http://bugs.python.org/issue5135)? If it's going to be in 2.7, I'd
> like to see it hit 3.1. The patch is against trunk (for 2.7) at the
> moment, I'm not sure what the process would be for forward-porting it
> (do I generate a new patch against the py3k branch, or should it be
> applied to trunk and merged in?)

Patches to the trunk are fine.

As for the actual feature, I don't think it should hold up releases.

--

-- 
Regards,
Benjamin
_______________________________________________
Python-Dev mailing list
Python-Dev <at> python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org


Gmane