New submission from Pierre Quentel :
In CPython 3.10 :
Python 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> @x = 123
File
Pierre Quentel added the comment:
I found why len() is required, it's to avoid trying to match the subject (thus
consuming a part of it) if its length is less than the number of non-star
patterns, as explained in the PEP.
My mistake, sorry
Pierre Quentel added the comment:
Oh, I did not invent this class, it is in the test script for pattern matching
:
https://github.com/python/cpython/blob/6948964ecf94e858448dd28eea634317226d2913/Lib/test/test_patma.py#L1932
With this class, [x, *_, y] matches, but not [x, *w, y
Pierre Quentel added the comment:
Thanks for the explanations, but I feel unconfortable with the fact that
variable-length sequence patterns are implemented the same as unpacking. (sorry
if this has been discussed before, I can't find references to the discussions
that lead to the current
New submission from Pierre Quentel :
This code
match range(42):
case [x, *w, y]:
z = 0
sets w to a list with 40 items : the length of the subject, minus the number of
non-star subpatterns.
But this code (adapted from test_patma_186) enters an infinite loop
Pierre Quentel added the comment:
Sorry, I don't know C so I can't write a PR for this change.
--
___
Python tracker
<https://bugs.python.org/issue44
New submission from Pierre Quentel :
PEP 634 specifies that
"A mapping pattern may not contain duplicate key values. (If all key patterns
are literal patterns this is considered a syntax error; otherwise this is a
runtime error and will raise ValueError.)"
but this is not wh
New submission from Pierre Quentel :
In the simplified version of Python grammar at
https://docs.python.org/3.10/reference/grammar.html, most 'invalid_' from
the complete grammar at
https://github.com/python/cpython/blob/3.10/Grammar/python.gram have been
removed, but 2 of them remain
Pierre Quentel added the comment:
That was a quick fix, thanks !
--
___
Python tracker
<https://bugs.python.org/issue38469>
___
___
Python-bugs-list mailin
New submission from Pierre Quentel :
PEP 572 says that "an assignment expression occurring in a (...) comprehension
(...) binds the target in the containing scope, honoring a nonlocal or global
declaration for the target in that scope, if one exists."
In Appendix B, the
Pierre Quentel added the comment:
Now that the PR has been merged, can someone close the issue ?
--
___
Python tracker
<https://bugs.python.org/issue20
Pierre Quentel added the comment:
@ethan.furman
Yes, in test_cgi.py, the method test_fieldstorage_multipart_w3c
https://github.com/python/cpython/blob/master/Lib/test/test_cgi.py#L316) uses a
multipart content with 2 files in it
(https://github.com/python/cpython/blob/master/Lib/test
Pierre Quentel added the comment:
The patch has been applied some time ago (I couldn't find the exact commit),
cf. https://github.com/python/cpython/blob/master/Lib/cgi.py#L750
I think we can close the issue.
--
nosy: +quentel
___
Python tracker
Pierre Quentel added the comment:
I have submitted another Pull Request (10771) that seems to fix the bug while
passing all the tests in test_cgi.py
--
nosy: +quentel
___
Python tracker
<https://bugs.python.org/issue27
Change by Pierre Quentel :
--
pull_requests: +10015
___
Python tracker
<https://bugs.python.org/issue2>
___
___
Python-bugs-list mailing list
Unsubscribe:
Pierre Quentel added the comment:
I have submitted PR #10638 to fix this issue.
--
___
Python tracker
<https://bugs.python.org/issue20504>
___
___
Python-bug
Change by Pierre Quentel :
--
pull_requests: +9885
___
Python tracker
<https://bugs.python.org/issue20504>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Pierre Quentel :
--
pull_requests: +9881
___
Python tracker
<https://bugs.python.org/issue20504>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Pierre Quentel :
--
nosy: +quentel
___
Python tracker
<https://bugs.python.org/issue20504>
___
___
Python-bugs-list mailing list
Unsubscribe:
Pierre Quentel added the comment:
The QUERY_STRING value is always set by the code at lines 1135-1137 of
http.server:
for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH',
'HTTP_USER_AGENT', 'HTTP_COOKIE', 'HTTP_REFERER'):
env.setdefault(k, "")
The R
Change by Pierre Quentel :
--
nosy: +quentel
___
Python tracker
<https://bugs.python.org/issue10486>
___
___
Python-bugs-list mailing list
Unsubscribe:
Pierre Quentel added the comment:
I have released the module as httpcompressionserver on PyPI :
https://pypi.org/project/httpcompressionserver/
--
___
Python tracker
<https://bugs.python.org/issue30
Pierre Quentel added the comment:
Brett,
Thanks for taking the time, you and other core devs, to review the PR and to
explain why you took this decision. I am disappointed by the result, but I
understand the reasons, having to face the same maintenance issues, on a much
smaller scale
Pierre Quentel <pierre.quen...@gmail.com> added the comment:
On the Github site Raymond Hettinger is mentioned as the reviewer. I don't know
how to contact him, can anyone ask him if he can review the PR on time for
inclusion in Python 3.7 ?
I understand that it's difficult to fin
Pierre Quentel <pierre.quen...@gmail.com> added the comment:
I think I have made all the changes requested in the code review (many thanks
to the reviewer !).
I see that the Pull Request has been flagged "awaiting core review". With the
deadline for Python 3.7 comin
Pierre Quentel <pierre.quen...@gmail.com> added the comment:
According to PEP 492, async and await should have been deprecated in 3.5 and
3.6, but I don't think they have been :
await = 1
def f(async=True):
...
don't raise any deprecation warning in 3.6.
Since version 3.7 will
Pierre Quentel added the comment:
On Python-ideas someone asked if other compressions could be supported besides
gzip.
The latest version of the PR adds a mechanism for that :
SimpleHTTPRequestHandler has a new attribute "compressions", a dictionary that
maps compression encodings
Pierre Quentel added the comment:
In the latest version of the PR, following Martin's comments :
- apply Chunk Transfer for HTTP/1.1 only, change implementation of compression
for previous protocols (send gzipped data without Content-Length)
- use http.cookiejar to parse the Accept-Encoding
Pierre Quentel added the comment:
Thanks for telling me. I must have run the test hundreds of times now, on a
Windows 7 PC, and this bug never occured.
Just for my information, why do you add temp.flush() in the "with" block ?
I thought the context manager took care of this.
2017-0
Pierre Quentel added the comment:
@martin.panter
Please forget my previous message. There is a 3rd solution, and you gave it :
no Content-Length and close the connection when all (compressed) data has been
sent.
--
___
Python tracker <
Pierre Quentel added the comment:
@martin.panter
For HTTP/1.0, since chunked transfer is not supported, and storage in a
temporary file is also not an option, I see 2 possible solutions :
- give up compressing big files - it would be a pity, compression is actually
made for them...
- compress
Pierre Quentel added the comment:
In the latest version of the Pull Request
(https://github.com/python/cpython/pull/2078/commits/6466c93555bec521860c57e832b691fe7f0c6c20)
:
- compression is disabled by default (compressed_types is set to [])
- as suggested by Chris Barker in the discussion
Pierre Quentel added the comment:
Maybe it's me who is doing things wrong, but when I run
Lib/test/test_httpservers.py I get this strange error :
Traceback (most recent call last):
File "C:\cpython\Lib\test\test_httpservers.py", line 7, in
from http.server import BaseHTTPRequ
Pierre Quentel added the comment:
Thank you Terry and Victor for your comments. I understand that you agree on
adding HTTP compression to http.server, but don't want it to be enabled by
default.
@terry.reedy
With the implementation proposed in the Pull Request, to disable compression
Pierre Quentel added the comment:
Is Python-ideas the appropriate place to get input from other core devs ?
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
New submission from Pierre Quentel:
I propose to add a mapping of file extension .json to mime type
"application/json".
This is registered in https://www.iana.org/assignments/media-types
--
components: Library (Lib)
messages: 297494
nosy: quentel, r.david.murray
priori
Pierre Quentel added the comment:
Thanks for the comments. I agree with some of them, and have improved the PR
accordingly, but I don't agree on the opinion that HTTP compression is beyond
the scope of http.server : like browser cache (which also implies a negociation
between client
Changes by Pierre Quentel <pierre.quen...@gmail.com>:
--
pull_requests: +2142
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Pierre Quentel added the comment:
The compression is done on the fly : if compression criteria are satisfied, the
original content is gzipped, either in memory or on a temporary file on disk,
depending on the file size.
The gzipped content is not cached, but since the server now supports
Pierre Quentel added the comment:
I propose this as a minor improvement to the built-in server, like the support
of browser cache that will be included in Python 3.7 (issue #29654, PR #298). I
understand that the server is not supposed to be full-featured, but HTTP
compression is widespread
Changes by Pierre Quentel <pierre.quen...@gmail.com>:
--
type: -> enhancement
___
Python tracker <rep...@bugs.python.org>
<http://bugs.pyt
New submission from Pierre Quentel:
The server in http.server currently doesn't support HTTP compression.
I propose to implement it in the method send_head() of SimpleHTTPRequestHandler
this way : for each GET request, if the request header "Accept-Encoding" is
present and incl
Pierre Quentel added the comment:
Senthil,
Can you take a look at the Pull Request when you have time ? The correct PR is
#991, not #990.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Changes by Pierre Quentel <pierre.quen...@gmail.com>:
--
pull_requests: +1163
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Changes by Pierre Quentel <pierre.quen...@gmail.com>:
--
pull_requests: +1162
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
New submission from Pierre Quentel:
In the cgi module, the parse_multipart() function duplicates code from
FieldStorage, and the result is not compliant with that of FieldStorage for
requests sent with multipart/form-data : for non-file fields, the value
associated with a key is a list
Pierre Quentel added the comment:
I close this issue and will open a more specific one for the rewriting of
parse_multipart()
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker <rep...@bugs.pytho
New submission from Pierre Quentel:
SimpleHTTPServer send a Last-Modified response header, but doesn't take into
account the If-Modified-Since header if it was sent by the user agent.
If a url matches a file and this file was not modified after the value of the
If-Modified-Since header
Le jeudi 28 avril 2016 10:36:27 UTC+2, Rahul Raghunath a écrit :
> 0
> down vote
> favorite
>
>
> I'm trying to create a simple http server with basic GET and POST
> functionality. The program is supposed to GET requests by printing out a
> simple webpage that greets a user and askes how
> > 127.0.0.1 - - [15/Apr/2016 20:57:32] "GET / HTTP/1.1" 200 -
> Hi Pierre,
>
> When I type http://localhost:8000, I did not see anything in the console
> after the line "Serving HTTP on 0.0.0.0 port 8000 ... I believe the way I ran
> was not correct as shown below:
> > python -m http.server
Le jeudi 14 avril 2016 22:50:33 UTC+2, wrh...@gmail.com a écrit :
> On Thursday, April 14, 2016 at 2:23:36 PM UTC-4, Andrew Farrell wrote:
> > What happens when you type
> >
> > http://localhost:8000
> >
> > Into the address bar of your browser as this is running?
> >
> > On Thu, Apr 14, 2016
Le dimanche 9 août 2015 11:25:17 UTC+2, Chris Angelico a écrit :
On Sun, Aug 9, 2015 at 7:06 PM, Pierre Quentel pierre.quen...@gmail.com
wrote:
For user-defined classes which do not define __contains__() but do define
__iter__(), x in y is true if some value z with x == z is produced while
The trap you're seeing here is that iterating over an iterator always
consumes it, but mentally, you're expecting this to be iterating over
a new instance of the same sequence.
No, I just tried to apply what I read in the docs :
1. I have y = A(10) which is an instance of a class which does
The documentation at
https://docs.python.org/3.5/reference/expressions.html#not-in says :
For user-defined classes which do not define __contains__() but do define
__iter__(), x in y is true if some value z with x == z is produced while
iterating over y. If an exception is raised during the
Pierre Quentel added the comment:
Victor, you can apply the patch and close the issue.
Le 7 août 2015 17:12, Peter Landry rep...@bugs.python.org a écrit :
Peter Landry added the comment:
A new patch that simply removes Content-Length from part headers when
present.
--
Added file
Pierre Quentel added the comment:
I don't really see why there is a Content-Length in the headers of a
multipart form data. The specification at
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2 doesn't
mention it, and it is absent in the example that looks like the one tested
Pierre Quentel added the comment:
Yes, I will be able to review the patch next week
2015-07-31 18:13 GMT+02:00 STINNER Victor rep...@bugs.python.org:
STINNER Victor added the comment:
@Pierre Quentel: Hi! Are you still working on CGI? Can you please review
this patch? Thanks
Hi,
Version 3.0.0 of Brython has been released recently
Brython is an implementation of Python 3 running in the browser, with an
interface to DOM elements and events. It allows writing web client applications
with Python instead of Javascript.
Python programs are inserted in the HTML page
Le lundi 24 février 2014 14:19:12 UTC+1, Jean-Michel Pichavant a écrit :
- Original Message -
On Sun, 23 Feb 2014 10:20:15 -0800, Pierre Quentel wrote:
The new home page of python.org is very nice, congratulations !
The best I can say about it is that I'm extremely
The new home page of python.org is very nice, congratulations !
But there is a problem with the online console provided by PythonAnywhere :
with my azerty keyboard, I can't enter characters such as ) or ] - very
annoying !
It this going to be fixed soon ?
- Pierre
--
Hi,
Brython (Browser Python) is an implementation of Python 3 in the browser. Its
goal is to be able to write client-side programs in Python instead of
Javascript, with code inside tags script type=text/python.../script. As
opposed to solutions such as Pyjamas or Py2JS, the translation from
Le vendredi 27 décembre 2013 15:56:33 UTC+1, jonas.t...@gmail.com a écrit :
Den fredagen den 27:e december 2013 kl. 07:14:35 UTC+1 skrev Pierre Quentel:
Hi,
Ever wanted to use Python instead of Javascript for web client programming
? Take a look at Brython
Le vendredi 27 décembre 2013 17:12:09 UTC+1, Johannes Schneider a écrit :
On 27.12.2013 07:14, Pierre Quentel wrote:
Hi,
Ever wanted to use Python instead of Javascript for web client programming
? Take a look at Brython, an implementation of Python 3 in the browser
Hi,
Ever wanted to use Python instead of Javascript for web client programming ?
Take a look at Brython, an implementation of Python 3 in the browser, with an
interface with DOM elements and events
Its use is very simple :
- load the Javascript library brython.js : script
Oh, and repr is just a synonym of str, which makes it useless.
3 days ago repr was not even implemented at all, so it's a step forward...
--
http://mail.python.org/mailman/listinfo/python-list
I was over-simplifying - or, to put is less diplomatically, I screwed up - when
I answered that the addition returned a string. As Chris pointed out, it made
the explanation very confusing. My apologies
The objects handled by + and = can be :
- strings, integers, floats
- instances of $TagClass
Still, it tends to be a lot harder to explain, document, and read
documentation for, something that uses operators weirdly, rather than
keyword-searchable method names.
You don't explain how to use the Python syntax (for instance the operator %,
which behaves very differently between integers
I forgot to mention : list comprehensions and the ternary operator (r1 if cond
else r2) are now supported !
- Pierre
--
http://mail.python.org/mailman/listinfo/python-list
If that's your intention, then instead of coming up with something totally
new, unpythonic and ugly, why not take the normal Python route and
implement a subset of the ElementTree API?
Stefan
Because the tree implementation in ElementTree or other tree modules in Python
require a lot of
Pythonic also means:
If the implementation is hard to explain, it's a bad idea.
What, exactly, does the sum of a string and a bolded string produce? Can you
explain that easily and clearly?
Yes : a+b returns the string a+str(b)
It is exactly what you get in CPython with
class B:
...
= is a comparison expression operator, which is completely different.
It is just wrong for this usage. I am 99.9% sure you will come to regret
it eventually. Better to make the change now than in Brython2 or Brython3.
I am 99.99% sure of the contrary, having used this syntax for more than 3
Hmm. So when that gets added into a DIV, it has to get parsed for
tags? How does this work? This seems very odd. I would have expected
it to remain as DOM objects.
In DIV(child) :
- if child is a string, integer or float, a text node is added (addChild) to
the DIV element, with the string
The interpreter, though, will be more than happy to treat that as a
comparison if the LHS is not the type that you think it is. For
example, maybe you've added it to a string at some point, and now it's
a string instead of an element. I guess that since doc is made a
keyword, that probably
Le jeudi 20 décembre 2012 01:07:15 UTC+1, Terry Reedy a écrit :
On 12/19/2012 1:19 PM, Pierre Quentel wrote:
The objective of Brython is to replace Javascript by Python as the
scripting language for web browsers, making it usable on all
terminals including smartphones, tablets
Le jeudi 20 décembre 2012 01:54:44 UTC+1, Ian a écrit :
On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy tjre...@udel.edu wrote:
That says that my browser, Firefox 17, does not support HTML5. Golly gee. I
don't think any browser support5 all of that moving target, and Gecko
apparently
Hi,
The objective of Brython is to replace Javascript by Python as the scripting
language for web browsers, making it usable on all terminals including
smartphones, tablets, connected TVs, etc. Please forgive the lack of ambition
;-)
The best introduction is to visit the Brython site
Pierre Quentel pierre.quen...@gmail.com added the comment:
I attach a new version after sharing thought with Glenn
CGI scripts are still unable to define which encoding to use to print the
strings received from the user agent. A patch was proposed #11066 but the issue
is still pending
Pierre Quentel pierre.quen...@gmail.com added the comment:
Hi,
I started working on a revised version of the whole cgi documentation. I mostly
changed paragraphs 2 3 (Using the CGI module and Higher level interface)
and replaced them by a paragraph still called Using the CGI module + 2 other
Pierre Quentel pierre.quen...@gmail.com added the comment:
Hi Glenn,
My proposal was not about optimization, I just thought that if x==y is
simpler than if len(x)==len(y) and x==y. Since we don't expect that there
will be many directories in the list, I don't think optimizing is so important
Pierre Quentel pierre.quen...@gmail.com added the comment:
Thanks for the explanation
I still think that the patch can be simplified, not using path lengths and the
found flag
collapsed_path = _url_collapse_path(self.path)
for head in self.cgi_directories:
if head==collapsed_path
Pierre Quentel pierre.quen...@gmail.com added the comment:
Hi Glenn, good to hear from you ;-)
I think the fix can be simplified replacing
dir_sep = collapsed_path.find('/', 1)
by
dir_sep = collapsed_path.rfind('/', 1)
--
nosy: +quentel
Pierre Quentel pierre.quen...@gmail.com added the comment:
There are 2 different problems :
- handling of data by cgi.FieldStorage (issue 4953) : fixed since version 3.2
- in http.server.CGIHTTPRequestHandler, for POST requests on Windows, before
opening the subprocess in run_cgi() all data
Changes by Pierre Quentel pierre.quen...@gmail.com:
--
nosy: +quentel
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8077
___
___
Python-bugs-list
Pierre Quentel pierre.quen...@gmail.com added the comment:
Thanks Hynek for raising this issue from the dead
Patch proposal attached. Sorry if there are markup errors, it's my first
contact with rst
--
Added file: http://bugs.python.org/file25416/cgi.rst
Pierre Quentel pierre.quen...@gmail.com added the comment:
Sorry about that. I didn't dare to say I was also a Mercurial newbie
--
Added file: http://bugs.python.org/file25421/cgi-doc-update.patch
___
Python tracker rep...@bugs.python.org
http
Changes by Pierre Quentel pierre.quen...@gmail.com:
Removed file: http://bugs.python.org/file25416/cgi.rst
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11352
Pierre Quentel pierre.quen...@gmail.com added the comment:
Thanks Senthil
I spot a typo in the first modified paragraph : cet instead of set
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11352
Hi,
A new version of the Karrigell web framework for Python 3.2+ has just
been released on http://code.google.com/p/karrigell/
One of the oldest Python web frameworks (the first version was
released back in 2002), it now has 2 main versions, one for Python 2
and another one for Python 3. The
Hi,
A new version of the Karrigell web framework for Python 3.2+ has just
been released on http://code.google.com/p/karrigell/
One of the oldest Python web frameworks around (the first version was
released back in 2002), it now has 2 main versions, one for Python 2
and another one for Python 3.
Please post code without non-code indents, like so:
Sorry about that. After the line Example : I indented the next
block, out of habit ;-)
What system are you using? Does it have a narrow or wide unicode build?
(IE, what is the value of sys.maxunicode?)
I use Windows XP Pro, version 2002,
Changes by Pierre Quentel pierre.quen...@gmail.com:
--
nosy: +quentel
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12922
___
___
Python-bugs-list
Hi,
I am wondering why relative seeks fail on string IO in Python 3.2
Example :
from io import StringIO
txt = StringIO('Favourite Worst Nightmare')
txt.seek(8) # no problem with absolute seek
but
txt.seek(2,1) # 2 characters from current position
raises IOError: Can't do
On 18 juil, 07:54, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
On Mon, 18 Jul 2011 08:54 am ΤΖΩΤΖΙΟΥ wrote:
Jumping in:
What if a construct
xx(*args1, **kwargs1)yy(*args2, **kwargs2)
was interpreted as
xxyy(*(args1+args2), **(kwargs1+kwargs2))
(Note: with
Pierre Quentel pierre.quen...@gmail.com added the comment:
When the FieldStorage class was fixed there was a discussion in issue 4953
about the module-level functions parse() and parse_multipart(). The code was
very similar to methods of the FieldStorage class so the idea was to use
Hi,
Karrigell is a web framework, that was only available for Python 2.x
so far (http://www.karrigell.fr)
With the cgi module now usable for Python 3 since version 3.2, a first
release of Karrigell for Python 3.2 is published and can be downloaded
from the project page :
New submission from Pierre Quentel pierre.quen...@gmail.com:
Hi,
I wrote a patch for the cgi module in version 3.2rc1 (#4953). Small changes
should be done to the documentation of this module to reflect the changes in
the module API :
- in section 20.2.2. Using the cgi module
original text
Pierre Quentel pierre.quen...@gmail.com added the comment:
bug, not buf...
--
title: Buf in cgi module doc - Bug in cgi module doc
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11352
Pierre Quentel pierre.quen...@gmail.com added the comment:
I opened issue #11066 for the code refactoring
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10911
Pierre Quentel pierre.quen...@gmail.com added the comment:
Here is the diff file for test_cgi.py
I added a test for a multipart/form-data form with non ASCII data to test the
encoding parameter of FieldStorage
--
keywords: +patch
Added file: http://bugs.python.org/file20611
New submission from Pierre Quentel pierre.quen...@gmail.com:
Python 3.2rc1 introduced a new version of cgi.py that handles correctly file
uploads
In this version, the FieldStorage constructor receives an argument encoding
which is the encoding used by the document holding the submitted form
1 - 100 of 233 matches
Mail list logo