Christoph Zwerschke added the comment:
I don't mind if you reopen your PR. But thanks for asking.
--
___
Python tracker
<https://bugs.python.org/issue43
Christoph Zwerschke added the comment:
I saw you submitted a PR already which looks good to me.
--
___
Python tracker
<https://bugs.python.org/issue43
New submission from Christoph Zwerschke :
Just noticed the following code in urrlib.parse_qsl:
pairs = [s1 for s1 in qs.split(separator)]
for name_value in pairs:
...
see
https://github.com/python/cpython/blob/088a15c49d99ecb4c3bef93f8f40dd513c6cae3b/Lib/urllib/parse.py#L755
Christoph Zwerschke added the comment:
Just created a test case for this problem after a pentest provoked this error
on one of my web apps. Then I found this bug report which already has a similar
test case attached.
The problem is that read_binary() as the name says reads binary data
Christoph Zwerschke added the comment:
This patch should really be included.
As carl already mentioned, the relevant spec is RFC 6265, see section 5.4.2:
"The user agent SHOULD sort the cookie-list in the following order: Cookies
with longer paths are listed before cookies with sh
Change by Christoph Zwerschke :
--
nosy: +cito
___
Python tracker
<https://bugs.python.org/issue18319>
___
___
Python-bugs-list mailing list
Unsubscribe:
Christoph Zwerschke added the comment:
Had the same problem for years and wondered why nobody else complained.
Still reproducable with Win 10 Pro 2004, Python 3.8, cp1252 locale.
Deleting hh.dat did not solve the problem for me.
--
nosy: +cito
New submission from Christoph Zwerschke :
A new action "extend" has been added to argparse in
https://github.com/python/cpython/commit/aa32a7e1116f7aaaef9fec453db910e90ab7b101
The documentation should specify that this is new in Python 3.8 addition. I
wondered why it didn't work
Christoph Zwerschke added the comment:
This also happens when sending POST requests with JSON payload from a browser
with XMLHttpRequest to a Python 3.7 backend using FieldStorage. It seems
XMLHttpRequest adds the content length automatically
Change by Christoph Zwerschke :
--
nosy: +cito
___
Python tracker
<https://bugs.python.org/issue2>
___
___
Python-bugs-list mailing list
Unsubscribe:
Christoph Zwerschke added the comment:
My point was that it's not immediately obvious what "by default" means and that
hashability is not only affected by the __hash__ method but also by __eq__.
But I agree, you can argue that "by default" already includes not adding
New submission from Christoph Zwerschke :
The Python documentation says about hashability in the glossary
(https://docs.python.org/3/glossary.html#term-hashable):
"Objects which are instances of user-defined classes are hashable by default."
This is not quite true. Objects of a us
Change by Christoph Zwerschke :
--
nosy: +cito
___
Python tracker
<https://bugs.python.org/issue34730>
___
___
Python-bugs-list mailing list
Unsubscribe:
-next.readthedocs.io/
PyPI: https://pypi.org/project/GraphQL-core-next/
Christoph Zwerschke
https://github.com/Cito
--
https://mail.python.org/mailman/listinfo/python-announce-list
Support the Python Software Foundation:
http://www.python.org/psf/donations/
Christoph Zwerschke <c...@online.de> added the comment:
I can confirm that the problem still exists in Python 3.6.4 and 3.7.0a4.
Here is another way to demonstrate it:
Create the following file test.py:
# test
hello = f"{world)}"
Note that there is a syntax error
Christoph Zwerschke added the comment:
> Corresponding GNU gettext issue [1] was closed as "Not a Bug".
Though I think the rationale given there pointing to RFC3629 section 6 is
wrong, since that section explicitly refers to Internet protocols, but PO files
are not an Inte
Christoph Zwerschke added the comment:
After this patch, some of the values in mimetypes.types_map now appear as
unicode instead of str in Python 2.7.7 under Windows. For compatibility and
consistency reasons, I think this should be fixed so that all values are
returned as str again under
New submission from Christoph Zwerschke:
The first paragraph in PCbuild/readme.txt of Python 3.3 still talks about
Visual C++ 2008 Express and Visual Studio 2008. It says that VS 2008 is
required at the very least (which may be still true, I'm not sure), but then it
also says the official
.
Version 1.1.1 runs on Python 2.4 to 2.7.
You can find more info on the Webware for Python homepage at
http://www.webwareforpython.org/
Support is available via the Webware for Python mailing lists at
https://sourceforge.net/mail/?group_id=4866
-- Christoph Zwerschke
--
http://mail.python.org
://www.w4py.org/DBUtils/Docs/UsersGuide.html
-- Christoph Zwerschke
--
http://mail.python.org/mailman/listinfo/python-announce-list
Support the Python Software Foundation:
http://www.python.org/psf/donations/
released along with the current version 1.1.
You can find more info on the Webware for Python homepage at
http://www.webwareforpython.org/
Support is available via the Webware for Python mailing lists at
https://sourceforge.net/mail/?group_id=4866
-- Christoph Zwerschke
--
http://mail.python.org
Christoph Zwerschke c...@online.de added the comment:
My point was that the passage starts with there are also many useful
built-in functions people seem not to be aware of for some reasons and
then it looks like the author himself was not aware of sum() for some
reason because he gives
New submission from Christoph Zwerschke c...@online.de:
In the section Using the batteries of the Idioms and Anti-Idioms in
Python document
(http://docs.python.org/dev/howto/doanddont.html#using-the-batteries),
the reduce statement is used for summing up numbers as an example. I
think
Changes by Christoph Zwerschke c...@online.de:
--
nosy: +cito
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2504
___
___
Python-bugs-list mailing
New submission from Christoph Zwerschke c...@online.de:
The Python 2.6.2 tutorial says at the end of secton 8.3
(http://docs.python.org/tutorial/errors.html#handling-exceptions):
But use of .args is discouraged. Instead, the preferred use is to pass
a single argument to an exception (which can
New submission from Christoph Zwerschke c...@online.de:
The cgi.Fieldstorage class supports the __contains__ method since Py
2.2, but the documentation of Py 2.6 still only mentions the old
fashioned has_key method. See patch.
--
assignee: georg.brandl
components: Documentation
files
Webware for Python 1.0.2 has been released.
This is the second bugfix release for Webware for Python release 1.0,
mainly fixing some problems and shortcomings of the PSP plug-in.
See the WebKit and PSP release notes for details.
Webware for Python is a suite of Python packages and tools for
Christoph Zwerschke c...@online.de added the comment:
This is a related problem on Windows:
'%g' % 1e400 - '1.#INF'
'%.f' % 1e400 -- '1'
--
nosy: +cito
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4799
Webware for Python 1.0.1 has been released.
This is the first bugfix release for Webware for Python release 1.0,
mainly fixing a problem that could appear when communicating with the
threaded application server over a network connection. See the WebKit
release notes for details.
Webware for
It cost me a while to analyze the cause of the following problem.
The symptom was that testing a local web app with twill was fast
on Python 2.3, but very slow on Python 2.4-2.6 on a Win XP box.
This boiled down to the problem that if you run a SimpleHTTPServer
for localhost like this,
rdmur...@bitdance.com schrieb:
Quoth Christoph Zwerschke c...@online.de:
With Py 2.3 (without IPv6 support) this is only the IPv4 address,
but with Py 2.4-2.6 the order is (on my Win XP host) the IPv6 address
first, then the IPv4 address. Since the IPv6 address is checked first
Steve Holden schrieb:
Search for the subject line socket.create_connection slow - this was
discovered by Kristjan Valur Jonsson. It certainly seems like a
Microsoft weirdness.
Thanks for the pointer, Steve. I hadn't seen that yet. I agree that's
actually the real problem here. The solution
New submission from Christoph Zwerschke c...@online.de:
If you install sgmlop (downloadable from
http://effbot.org/downloads/#sgmlop) under Python 2.x, then this can
break xmlrpclib.
You can reproduce this problem as follows (I have tested with Py 2.4,
2.5 and 2.6):
data = ?xml
Changes by Christoph Zwerschke c...@online.de:
--
keywords: +patch
Added file: http://bugs.python.org/file12418/xmlrpclib.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4713
Carl Banks schrieb:
You are free to use it for other things. For example, the following
usage is obvious and sensible (insofar as listing exceptions is
sensible):
def f(x : int) - int, raises(TypeError)
Think of the return value annotation as more of a function outcome
annotation.
That's
Terry Reedy wrote:
I would agree... but...
The problem is that code that uses a function hardly cares whether an
exception that replaces the normal return is raised explicitly, by a
syntax operation (and these are not yet completely documented, though
perhaps they should be), or by a
Carl Banks wrote:
If it bothers you that much, go file a bug report. Someone might even
change it. But it's nothing but needless pedantry.
Has my de domain inspired you to rant about pedantry? No, it does
not bother me that much. I just thought the PEP could be clearer here
and explicitly
Matimus wrote:
Christoph wrote:
Maybe the following syntax would be even more intuitive:
def foo(a: a info, b: b info) return ret info raise exc info:
return hello world
That seems much more intuitive and extensible. The - syntax has
always bothered me. The main issue I see with
Carl Banks wrote:
I think you're missing the point here. PEP 3017 is policy-neutral:
it describes a mechanism to annotate functions and arguments,
and that's it.
That's not quite true: PEP 3017 describes a mechanism for annotating
function parameters *and return values*, and my point was why
Matimus schrieb:
The expr in that raises clause should be a list of Exceptions.
You are clearly confusing the annotation feature with a possible
application of the annotation feature. Annotation could be used for
many different applications besides type safety.
Sorry, I wanted to say *could*
Duncan Booth wrote:
If you really want this then you can use a decorator to insert a 'raise'
key into the annotations:
Well, yes, but wasn't the whole point of PEP 3107 to get rid of such
decorators and provide a single standard way of specifying this kind of
info instead?
I don't know
Duncan Booth schrieb:
There is no currently recommended way to make such annotations, so how
could the PEP mention it?
Then it could mention the fact that there is currently no recommended
way (and maybe make some suggestions, like those given by you).
--
I'm just reading PEP 3107 (function annotations) and wonder why
exceptions are not mentioned there. I think it would be helpful if one
could specify which exceptions can be raised by a function, similarly to
how it is possible in C++ using the throw clause. The syntax would be
something like
Christoph Zwerschke [EMAIL PROTECTED] added the comment:
Small improvement of the patch: Instead of hardcoding the BOM as
'\xef\xbb\xbf', we should use codecs.BOM_UTF8.
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1697943
New submission from Christoph Zwerschke [EMAIL PROTECTED]:
When you sort a list with list.sort() or sorted(list), and set the
reverse parameter to None, then you get the following misleading error
message:
TypeError: an integer is required
I would expect a more proper error message
Christoph Zwerschke [EMAIL PROTECTED] added the comment:
The problem is not only that the error message TypeError: an integer is
required has integer instead of boolean, but it does not mention
the attribute name reverse, i.e. it does not even say *where* the
integer is required. I firmly
Christoph Zwerschke [EMAIL PROTECTED] added the comment:
Agree. Seems to be a more general weakness of the argument parsing of
builtin functions and methods, that calls for a general solution instead
of a local patch. Luckily there are not so many cases where the errors
are misleading, since
Duncan Booth schrieb:
if url.startswith('http://'):
url = url[7:]
If I came across this code I'd want to know why they weren't using
urlparse.urlsplit()...
Right, such code can have a smell since in the case of urls, file names,
config options etc. there are specialized functions
In Python programs, you will quite frequently find code like the
following for removing a certain prefix from a string:
if url.startswith('http://'):
url = url[7:]
Similarly for stripping suffixes:
if filename.endswith('.html'):
filename = filename[:-5]
My problem with this is that
Bruno Desthuilliers schrieb:
DRY/SPOT violation. Should be written as :
prefix = 'http://'
if url.startswith(prefix):
url = url[len(prefix):]
That was exactly my point. This formulation is a bit better, but it
still violates DRY, because you need to type prefix two times. It is
New submission from Christoph Zwerschke [EMAIL PROTECTED]:
While locale.strcoll seems to work with Unicode strings, locale.strxfrm
gives a UnicodeError. Example:
###
try:
locale.setlocale(locale.LC_ALL, 'de')
except locale.Error: # Windoof
locale.setlocale(locale.LC_ALL, 'german')
s
Arnaud Delobelle schrieb:
It's a FAQ:
http://www.python.org/doc/faq/programming/#how-do-i-create-a-multidimensional-list
Somewhere on my todo list I have read through the whole Python FAQ,
but so far never got round doing it. Should probably set it to prio A.
-- Christoph
--
Marc 'BlackJack' Rintsch schrieb:
On Sun, 02 Mar 2008 14:15:09 +, Steve Turner wrote:
Apart from doing something like
a=[0,0,0]
b=[0,0,0]
c=[0,0,0]
d=[a,b,c]
is there a better way of creating d??
a = [[0] * 3 for dummy in xrange(3)]
Why not simply [[0]*3]*3 ?
-- Christoph
--
Paul Boddie schrieb:
On 2 Mar, 19:06, Alan Isaac [EMAIL PROTECTED] wrote:
On April 12th, 2007 at 10:05 PM Alan Isaac wrote:
The avoidance of tuples, so carefully defended in other
terms, is often rooted (I claim) in habits formed from
need for list methods like ``index`` and ``count``.
Christoph Zwerschke added the comment:
Thanks, this now makes sense to me. You're right, it's rather an ugly
wart than a bug.
But I think the Python reference needs to be improved to make this clear
enough.
How about the following proposed addtions (in square brackets) to
section 5.2.5 (http
samwyse wrote:
NewStyle.__name__ = old.__class__.__name__
Simple, but that does the trick!
new.__dict__ = old.__dict__.copy()
Unfortunately, that does not work, since the attributes are not
writeable and thus do not appear in __dict__.
But my __getattr__ solution does not work either,
Christoph Zwerschke wrote:
But my __getattr__ solution does not work either, since the attributes
are set to None when initialized, so __getattr__ is never called.
Here is a simple solution, but it depends on the existence of the args
attribute that will eventually be deprecated according
Christoph Zwerschke wrote:
Here is a simple solution, but it depends on the existence of the args
attribute that will eventually be deprecated according to the docs:
Ok, here is another solution that does not depend on args:
def PoliteException(e):
E = e.__class__
class
Christoph Zwerschke wrote:
Here is a simple solution, but it depends on the existence of the args
attribute that will eventually be deprecated according to the docs:
Just found another amazingly simple solution that does neither use teh
.args (docs: will eventually be deprecated) attribute
samwyse wrote:
TypeError: __class__ must be set to a class
Excpt ceratinly appears to be a class. Does anyone smarter than me
know what's going on here?
Not that I want to appear smarter, but I think the problem here is that
exceptions are new-style classes now, whereas Empty is an
Webware 0.9.4 and DBUtils 0.9.4 have been released.
The new release of Webware for Python contains some fixes and
improvements of WebKit, and it adds some more configuration settings
that have been requested by users. The details can be found in the
WebKit release notes.
The new DBUtils release
Did you run this?
With Py 2.5 I get a syntax error, and with Py 2.5 I get:
new.__class__ = old.__class__
TypeError: __class__ must be set to a class
-- Chris
--
http://mail.python.org/mailman/listinfo/python-list
samwyse wrote:
def test(code):
try:
code()
except Exception, e:
try:
raise e.__class__, str(e) + , sorry!
except TypeError:
raise SorryFactory(e)()
Ok, you're suggestig the naive approach if it works and the factory
approach I came up with last as a fallback.
Gerard Flanagan wrote:
Would a decorator work here?
Depends on how you want to use that functionality. In my use case I only
need to catch the excpetion once.
Note that in your code the exception has not the right type which is
what I targeted in my last posting. I.e. the following will raise
What is the best way to re-raise any exception with a message
supplemented with additional information (e.g. line number in a
template)? Let's say for simplicity I just want to add sorry to every
exception message. My naive solution was this:
try:
...
except Exception, e:
raise
Thomas Heller wrote:
I have the impression that you do NOT want to change the exceptions,
instead you want to print the traceback in a customized way. But I may be
wrong...
No, I really want to modify the exception, supplementing its message
with additional information about the state of
Neil Cerutti wrote:
The documentation for BaseException contains something that might
be relevant:
[...] If more data needs to be attached to the exception,
attach it through arbitrary attributes on the instance. All
Users could get at the extra info you attached, but it wouldn't
be
Nis Jørgensen wrote:
The problem is, these functions can be read as X is [consisting only
of] digit[s], X is lower [case] etc, where the bits in brackets have
been removed for brewity. In the case of s1 is intersect s2 there is
no way I can see of adding words to get a correct sentence. The
Neil Cerutti wrote:
You may need the traceback module to get at the error message, if
trying to read e.message can fail.
Something like this mess here: ;)
...
except Exception, e:
etype, evalue, etb = sys.exc_info()
ex = traceback.format_exception_only(etype, evalue)
Steven D'Aprano wrote:
I'm not a professional set theorist, but in 15-odd years of studying and
teaching maths I've never come across mathematicians using intersect as a
verb except as informal short-hand. I often say North Street and South
Street don't intersect, but the intersection of sets
Kay Schluehr wrote:
If you are sure that the exception isn't caught on another level just
use the following showtraceback() function, manipulate it's output
slightly and terminate your program with sys.exit()
That's what I want to avoid. In my case the error is displayed and
evaluated in a
Seems that no simple solution exists,
so for now, I will be using something like this:
class PoliteException(Exception):
def __init__(self, e):
self._e = e
def __getattr__(self, name):
return getattr(self._e, name)
def __str__(self):
if
Sorry for the soliloquy, but what I am really using is the following so
that the re-raised excpetion has the same type:
def PoliteException(e):
class PoliteException(e.__class__):
def __init__(self, e):
self._e = e
def __getattr__(self, name):
Alex Popescu wrote:
Probably the simplest solution would be to create a new exception and
wrapping the old one and the additional info. Unfortunately, this
may have a huge impact on 3rd party code that was catching the
original exception. So, I think you should create an utility
Webware 0.9.3 has been released.
This release of Webware for Python includes a couple of fixes and
improvements of WebKit and some cleanup of the overall Webware codebase.
Please have a look at the WebKit release notes for details.
Webware for Python is a suite of Python packages and tools for
I'm currently investigating a problem that can hit you in TurboGears
when Kid template modules are reloaded in the background, because in
certain situations, global variables suddenly are set to None values.
I tracked it down to the following behavior of Python. Assume you have a
module
Yes I know about reload(), but TurboGears (TurboKid) does not use it and
the docs say that removing modules from sys.module is possible to force
reloading of modules. I don't want to rewrite everything since it's a
pretty complex thing with modules which are compiled from templates
which can
Thanks for the detailed explanations, Gabriel.
At that time, all values in the module namespace are set to
None (for breaking possible cycles, I presume). print_hello now has a
func_globals with all names set to None. (Perhaps the names could have
been deleted instead, so print_hello()
Martin v. Löwis schrieb:
Christoph Zwerschke schrieb:
Shall I proceed writing such a patch? Shall I also add latin0 and l0
which are other inofficial aliases?
Sure, go ahead. I see no need for the latin0/l0 aliases, though: they
predate the formal adoption of iso-8859-15, and should
Hendrik van Rooyen wrote:
From a practical point of view, the only reason to use a tuple instead
of a list for anything seems to be that you want to use it as a key in a
dict...
Otherwise, why bother with these recalcitrant things that you can't
change or index, or append to or anything
James Stroud wrote:
Christoph Zwerschke wrote:
Maybe there would be less dispute if this dogma/convention(?) Tuples
are for heterogeneous data, list are for homogeneous data would be
written down somewhere in the tutorial, reference or in PEP8, so
people would be aware
Maybe there would be less dispute if this dogma/convention(?) Tuples
are for heterogeneous data, list are for homogeneous data would be
written down somewhere in the tutorial, reference or in PEP8, so people
would be aware of it.
And can somebody explain what is exactly meant with homogenous
Martin v. Löwis wrote:
While you are at it, you'll notice that the current version of the
character-sets database lists
Name: ISO-8859-15
MIBenum: 111
Source: ISO
Please see:
http://www.iana.org/assignments/charset-reg/ISO-8859-15
Alias: ISO_8859-15
Alias: Latin-9
so the
Tim Golden wrote:
Christoph Zwerschke wrote:
And can somebody explain what is exactly meant with
homogenous data?
This seems to have been explained a few times
recently :) Basically, if you have a list of xs
and remove one item from it, it is still a list of xs,
According
I noticed that Python does not understand the codec alias names
latin7 = iso8859-13, latin9 = iso8859-15
(see http://docs.python.org/lib/standard-encodings.html).
Particularly latin9 is pretty popular here in Western Europe since it
contains the Euro symbol (contrary to latin1).
According to
Tor Erik Soenvisen wrote:
How safe is the following code against SQL injection:
# Get user privilege
digest = sha.new(pw).hexdigest()
# Protect against SQL injection by escaping quotes
uname = uname.replace(', '')
sql = 'SELECT privilege FROM staff
goyatlah wrote:
urllib.url2pathname(http://127.0.0.1:1030/js.cgi?pcaamp;r=12181;)
gives IOError : Bad Url, only coz of the :1030 which should be
accurate portnumber. Is it something I did wrong, or a bug. And what
to do to avoid this (except rewriting url2pathname)?
://www.w4py.org/DBUtils/Docs/UsersGuide.html
-- Christoph Zwerschke
--
http://mail.python.org/mailman/listinfo/python-announce-list
Support the Python Software Foundation:
http://www.python.org/psf/donations.html
Webware 0.9.2 has been released.
This release of Webware for Python includes a couple of fixes
and improvements of WebKit, MiddleKit, MiscUtils and WebUtils
(see the respective release notes).
Webware for Python is a suite of Python packages and tools for
developing object-oriented, web-based
Martin v. Löwis wrote:
In Python 2.4 and later, you could write
def Distance(t1, t0, maxint=(132)-1):
return (t1-t0) maxint
No, this function behaves differently. It never returns a negative
value. The only difference in Python 2.4 is that 132 was 0 before.
-- Christoph
--
Ilpo Nyyssönen wrote:
It is not different. Your crash can tell you that it was a null
pointer. Your crash can tell you that you stomped over memory. You
just get the information about the error in different way.
Not all stomping over memory must result in a crash. You might just get
wrong
Girish Sahani schrieb:
Given a length k string,i want to search for 2 substrings (overlap
possible) in a list consisting of length k-1 strings. These 2 substrings
when 'united' give the original string.
e.g given 'abc' i want to search in the list of 2-length strings
['ab',ac','cd','bc','bd']
su wrote:
could someone help me on how can i restrict
my code to search the file in the current dir only
Use os.listdir().
-- Christoph
--
http://mail.python.org/mailman/listinfo/python-list
Simon Percivall wrote:
First: It's perfectly simple in Java to create a binary sort that
sorts all arrays that contain objects; so wrong there.
My point was that the *same* Java source example, directly converted to
Python would *automatically* accept all kinds of arrays.
And the same
Kaz Kylheku wrote:
You can have statically typed languages with inadequate type safety,
and you can have dynamically typed languages with inadequate type
safety.
But the point in this example was that the Java program ironically had
the bug *because* Java handles ints in a type-safe way,
nikie wrote:
Let's look at two different examples: Consider the following C# code:
static decimal test() {
decimal x = 10001;
x /= 100;
x -= 100;
return x;
It returns 0.01, as you would expect it.
Yes, I would expect that because I have defined x as decimal, not int.
nikie wrote:
Hm, then I probably didn't get your original point: I thought your
argument was that a dynamically typed language was safer because it
would choose the right type (in your example, an arbitrary-pecision
integer) automatically.
No, my point was not to make a general statement.
You will often hear that for reasons of fault minimization, you should
use a programming language with strict typing:
http://turing.une.edu.au/~comp284/Lectures/Lecture_18/lecture/node1.html
I just came across a funny example in which the opposite is the case.
The following is a binary search
Simon Percivall wrote:
First: It's perfectly simple in Java to create a binary sort that
sorts all arrays that contain objects; so wrong there.
My point was that the *same* Java source example, directly converted to
Python would *automatically* accept all kinds of arrays. No need to make
Cameron Laird wrote:
So, here's my summary: Python's a nice language--a very nice one.
It's safer to use than Java in many ways. Python's typing is
STRICTER than Java's, but it's also dynamic, so people get to argue
for decades about which is a better model. Anyone who thinks typing
is a
1 - 100 of 306 matches
Mail list logo