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,
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] : this is
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 cu
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.o
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 what ha
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 t
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 PEP
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 tr
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_RE
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, with
Pierre Quentel 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 find time for this and that
Pierre Quentel 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 coming soon (11 weeks), is there a chanc
Pierre Quentel 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 break existing c
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-Enc
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
<h
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 on
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 BaseHTT
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 compressi
Pierre Quentel added the comment:
Is Python-ideas the appropriate place to get input from other core devs ?
--
___
Python tracker
<http://bugs.python.org/issue30
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 clien
Changes by Pierre Quentel :
--
pull_requests: +2142
___
Python tracker
<http://bugs.python.org/issue30576>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 :
--
type: -> enhancement
___
Python tracker
<http://bugs.python.org/issue30576>
___
___
Python-bugs-list mailing list
Unsubscrib
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
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
<http://bugs.python.org/issue29
Changes by Pierre Quentel :
--
pull_requests: +1163
___
Python tracker
<http://bugs.python.org/issue29979>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Pierre Quentel :
--
pull_requests: +1162
___
Python tracker
<http://bugs.python.org/issue29979>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 of
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
<http://bug
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
Pierre Quentel added the comment:
Victor, you can apply the patch and close the issue.
Le 7 août 2015 17:12, "Peter Landry" a écrit :
>
> Peter Landry added the comment:
>
> A new patch that simply removes Content-Length from part headers when
> present.
>
>
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
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 :
>
> STINNER Victor added the comment:
>
> @Pierre Quentel: Hi! Are you still working on CGI? Can you please review
> this patch? Thanks.
>
>
Pierre Quentel 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. The new version documents this
Pierre Quentel 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 modu
Pierre Quentel 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
Pierre Quentel 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:
self.cgi_in
Pierre Quentel 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
___
P
Pierre Quentel 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 is read by a *single* call
Changes by Pierre Quentel :
--
nosy: +quentel
___
Python tracker
<http://bugs.python.org/issue8077>
___
___
Python-bugs-list mailing list
Unsubscribe:
Pierre Quentel added the comment:
Thanks Senthil
I spot a typo in the first modified paragraph : "cet" instead of "set"
--
___
Python tracker
<http://bug
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file25416/cgi.rst
___
Python tracker
<http://bugs.python.org/issue11352>
___
___
Python-bugs-list mailin
Pierre Quentel 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
<http://bugs.python.org/is
Pierre Quentel 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
___
P
Changes by Pierre Quentel :
--
nosy: +quentel
___
Python tracker
<http://bugs.python.org/issue12922>
___
___
Python-bugs-list mailing list
Unsubscribe:
Pierre Quentel 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
FieldStorage inside the functions
Pierre Quentel added the comment:
"bug", not "buf"...
--
title: Buf in cgi module doc -> Bug in cgi module doc
___
Python tracker
<http://
New submission from Pierre Quentel :
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 added the comment:
I opened issue #11066 for the code refactoring
--
___
Python tracker
<http://bugs.python.org/issue10911>
___
___
Python-bug
New submission from Pierre Quentel :
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
On the CGI s
Pierre Quentel 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/tes
Pierre Quentel added the comment:
Hi,
I have written more tests, but also propose changes to cgi.py :
- rewrite the parse_qs() and parse_multipart() functions so that they use
FieldStorage methods instead of duplicating them
- add a function set_stdout_encoding(encoding), using the IOMix
Pierre Quentel added the comment:
My latest patch for test_cgi is in cgi_32.patch
I will try to add more tests later
--
___
Python tracker
<http://bugs.python.org/issue4
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file20405/unnamed
___
Python tracker
<http://bugs.python.org/issue4953>
___
___
Python-bugs-list mailin
Pierre Quentel added the comment:
Thanks a lot Victor !
I wrote the patch : Pierre Quentel (pierre.quen...@gmail.com) with many
inputs by Glenn Linderman
2011/1/14 STINNER Victor
>
> STINNER Victor added the comment:
>
> Oh, I forgot to credit the author(s): who wro
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file20402/cgi_32.patch
___
Python tracker
<http://bugs.python.org/issue4953>
___
___
Python-bugs-list m
Pierre Quentel added the comment:
Glenn, you read my mind ;-)
Thanks for mentioning the O_BINARY thing. New (last !) patch attached
--
Added file: http://bugs.python.org/file20403/cgi_32.patch
___
Python tracker
<http://bugs.python.org/issue4
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file20387/cgi_32.patch
___
Python tracker
<http://bugs.python.org/issue4953>
___
___
Python-bugs-list m
Pierre Quentel added the comment:
@Victor
Thanks for the comments
"- I don't understand why FieldStorage changes sys.stdout and sys.stderr (see
remarks about IOMix above): please remove the charset argument (it is also
confusing to have two encoding arguments). it should be done
Pierre Quentel added the comment:
Comment ça, no up to date patch ? cgi_32.patch is up to date, the API changes
are documented, the unittests work, what else do you want ?
--
___
Python tracker
<http://bugs.python.org/issue4
Pierre Quentel added the comment:
Ok, thanks. Here is a summary of the API changes :
- the argument fp passed to FieldStorage is either an instance of (a subclass
of) io.TextIOBase with a "buffer" attribute for the underlying binary layer
(thus, it can't be a StringIO in
Pierre Quentel added the comment:
Ok Eric, thanks for the tips
I attach the diff for the 2 modified modules (cgi.py and test_cgi.py). For the
other tests, they are not in the branch and there are many test files so I
leave the zip file
I removed outdated diffs
--
Added file: http
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file20244/cgi_diff.txt
___
Python tracker
<http://bugs.python.org/issue4953>
___
___
Python-bugs-list m
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file20384/test_cgi_20111013.diff
___
Python tracker
<http://bugs.python.org/issue4953>
___
___
Python-bug
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file20383/cgi_20110113.diff
___
Python tracker
<http://bugs.python.org/issue4953>
___
___
Python-bug
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file20382/cgi_diff_20110112.txt
___
Python tracker
<http://bugs.python.org/issue4953>
___
___
Python-bug
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file20356/cgi_diff_20110111.txt
___
Python tracker
<http://bugs.python.org/issue4953>
___
___
Python-bug
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file20323/cgi_tests.zip
___
Python tracker
<http://bugs.python.org/issue4953>
___
___
Python-bugs-list m
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file20322/cgi_diff_20110109.txt
___
Python tracker
<http://bugs.python.org/issue4953>
___
___
Python-bug
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file20235/cgi_diff.txt
___
Python tracker
<http://bugs.python.org/issue4953>
___
___
Python-bugs-list m
Changes by Pierre Quentel :
Removed file: http://bugs.python.org/file20229/cgi_diff.txt
___
Python tracker
<http://bugs.python.org/issue4953>
___
___
Python-bugs-list m
Pierre Quentel added the comment:
zip file with the updated cgi_test.py and associated files
--
Added file: http://bugs.python.org/file20385/cgi_tests.zip
___
Python tracker
<http://bugs.python.org/issue4
Pierre Quentel added the comment:
diff for the updated version of test_cgi.py, compatible with cgi.py
--
Added file: http://bugs.python.org/file20384/test_cgi_20111013.diff
___
Python tracker
<http://bugs.python.org/issue4
Pierre Quentel added the comment:
I knew the builtins hack was terrible, thanks for the replies...
I changed cgi.py with Glenn's IOMix class, and included the changes in
make_file(). The patch is attached to this message
Is it really too late to include it in 3.2 ? Missing a workin
Pierre Quentel added the comment:
Many thoughts and tests after...
Glenn, the both of us were wrong : the encoding to use in FieldStorage is
neither latin-1, nor sys.stdin.encoding : I tested form fields with characters
whose utf-8 encoding has bytes that map to undefined in cp1252, the
Pierre Quentel added the comment:
@Glenn
"I'm curious what your system (probably Windows since you mention cp-) and
browser, and HTTP server is, that you used for that test. Is it possible to
capture the data stream for that test? Describe how, and at what stage the
data
Pierre Quentel added the comment:
@Glenn
" The _defined_ encoding of the original stream is irrelevant, in the same
manner that if it is a text stream, that is irrelevant. The stream is binary,
and latin-1, or it is non-standard"
I wish it could be as simple, but I'm afraid
Pierre Quentel added the comment:
@Glenn
"Also, the use of FeedParser could be replaced by BytesFeedParser, thus
eliminating the need to decode header lines in that loop."
BytesFeedParser only uses the ascii codec ; if the header has non ASCII
characters (filename in a multipart
Pierre Quentel added the comment:
cgi tests
--
Added file: http://bugs.python.org/file20323/cgi_tests.zip
___
Python tracker
<http://bugs.python.org/issue4
Pierre Quentel added the comment:
Here is the diff file for the revised version of cgi.py
FieldStorage tests if the stream is an instance of (a subclass of)
io.TextIOBase. If true, data is read from its attribute buffer ; if it hasn't
one (eg for StringIO instances), an AttributeExcepti
Pierre Quentel added the comment:
Option 1 is impossible, because the CGI script sometimes has no control on the
stream : for instance on a shared web host, it will receive sys.stdin as a text
stream
I also vote for option 3 ; explaining that if no argument is passed, the
program will use
Pierre Quentel added the comment:
I agree that the only consistent solution is to impose that the attribute
self.fp must read bytes in all cases, all required conversions should occur
inside FieldStorage, using "some" encoding (not sure how to define it...)
If no argument fp is
1 - 100 of 107 matches
Mail list logo