Mark Dickinson
e9a5a549e4
Fix incorrect stacklevel for struct warnings. (Partial backport of r78690).
2010-04-06 15:19:40 +00:00
Georg Brandl
40e15edd65
Merged revisions 69578-69580,69901,69907,69994,70022-70023,70025-70026,70166,70273,70275,70342,70386-70387,70389-70390,70392-70393,70395,70397,70400,70418 via svnmerge
...
........
r69578 | georg.brandl | 2009-02-13 12:03:59 +0100 (Fr, 13 Feb 2009) | 1 line
#3694 : add test for fix committed in r66693.
........
r69579 | georg.brandl | 2009-02-13 12:06:59 +0100 (Fr, 13 Feb 2009) | 2 lines
Fix warnings GCC emits where the argument of PyErr_Format is a single variable.
........
r69580 | georg.brandl | 2009-02-13 12:10:04 +0100 (Fr, 13 Feb 2009) | 2 lines
Fix warnings GCC emits where the argument of PyErr_Format is a single variable.
........
r69901 | georg.brandl | 2009-02-23 12:24:46 +0100 (Mo, 23 Feb 2009) | 2 lines
#5349 : C++ pure virtuals can also have an implementation.
........
r69907 | georg.brandl | 2009-02-23 19:33:48 +0100 (Mo, 23 Feb 2009) | 1 line
Fix grammar.
........
r69994 | georg.brandl | 2009-02-26 18:36:26 +0100 (Do, 26 Feb 2009) | 1 line
Document that setting sys.py3kwarning wont do anything.
........
r70022 | georg.brandl | 2009-02-27 17:23:18 +0100 (Fr, 27 Feb 2009) | 1 line
#5361 : fix typo.
........
r70023 | georg.brandl | 2009-02-27 17:39:26 +0100 (Fr, 27 Feb 2009) | 1 line
#5363 : fix cmpfiles() docs. Another instance where a prose description is twice as long as the code.
........
r70025 | georg.brandl | 2009-02-27 17:52:55 +0100 (Fr, 27 Feb 2009) | 1 line
#5344 : fix punctuation.
........
r70026 | georg.brandl | 2009-02-27 17:59:03 +0100 (Fr, 27 Feb 2009) | 1 line
#5365 : add quick look conversion table for different time representations.
........
r70166 | georg.brandl | 2009-03-04 19:24:41 +0100 (Mi, 04 Mär 2009) | 2 lines
Remove obsolete stuff from string module docs.
........
r70273 | georg.brandl | 2009-03-09 15:25:07 +0100 (Mo, 09 Mär 2009) | 2 lines
#5458 : add a note when we started to raise RuntimeErrors.
........
r70275 | georg.brandl | 2009-03-09 17:35:48 +0100 (Mo, 09 Mär 2009) | 2 lines
Add missing space.
........
r70342 | georg.brandl | 2009-03-13 20:03:58 +0100 (Fr, 13 Mär 2009) | 1 line
#5486 : typos.
........
r70386 | georg.brandl | 2009-03-15 22:32:06 +0100 (So, 15 Mär 2009) | 1 line
#5496 : fix docstring of lookup().
........
r70387 | georg.brandl | 2009-03-15 22:37:16 +0100 (So, 15 Mär 2009) | 1 line
#5493 : clarify __nonzero__ docs.
........
r70389 | georg.brandl | 2009-03-15 22:43:38 +0100 (So, 15 Mär 2009) | 1 line
Fix a small nit in the error message if bool() falls back on __len__ and it returns the wrong type: it would tell the user that __nonzero__ should return bool or int.
........
r70390 | georg.brandl | 2009-03-15 22:44:43 +0100 (So, 15 Mär 2009) | 1 line
#5491 : clarify nested() semantics.
........
r70392 | georg.brandl | 2009-03-15 22:46:00 +0100 (So, 15 Mär 2009) | 1 line
#5488 : add missing struct member.
........
r70393 | georg.brandl | 2009-03-15 22:47:42 +0100 (So, 15 Mär 2009) | 1 line
#5478 : fix copy-paste oversight in function signature.
........
r70395 | georg.brandl | 2009-03-15 22:51:48 +0100 (So, 15 Mär 2009) | 1 line
#5276 : document IDLESTARTUP and .Idle.py.
........
r70397 | georg.brandl | 2009-03-15 22:53:56 +0100 (So, 15 Mär 2009) | 1 line
#5469 : add with statement to list of name-binding constructs.
........
r70400 | georg.brandl | 2009-03-15 22:59:37 +0100 (So, 15 Mär 2009) | 3 lines
Fix markup in re docs and give a mail address in regex howto, so that
the recommendation to send suggestions to the author can be followed.
........
r70418 | georg.brandl | 2009-03-16 20:42:03 +0100 (Mo, 16 Mär 2009) | 1 line
Add token markup.
........
2009-04-05 21:48:06 +00:00
Georg Brandl
47fe9817f1
Merged revisions 67952-67953,67955,67957-67958,67960-67961,67963,67965,67967,67970-67971,67973,67982,67988,67990,67995,68014,68016,68030,68057,68061,68112,68115-68118,68120-68121,68123-68128 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67952 | georg.brandl | 2008-12-27 18:42:40 +0100 (Sat, 27 Dec 2008) | 2 lines
#4752 : actually use custom handler in example.
........
r67953 | georg.brandl | 2008-12-27 19:20:04 +0100 (Sat, 27 Dec 2008) | 3 lines
Patch #4739 by David Laban: add symbols to pydoc help topics,
so that ``help('@')`` works as expected.
........
r67955 | georg.brandl | 2008-12-27 19:27:53 +0100 (Sat, 27 Dec 2008) | 3 lines
Follow-up to r67746 in order to restore backwards-compatibility for
those who (monkey-)patch TextWrapper.wordsep_re with a custom RE.
........
r67957 | georg.brandl | 2008-12-27 19:49:19 +0100 (Sat, 27 Dec 2008) | 2 lines
#4754 : improve winsound documentation.
........
r67958 | georg.brandl | 2008-12-27 20:02:59 +0100 (Sat, 27 Dec 2008) | 2 lines
#4682 : 'b' is actually unsigned char.
........
r67960 | georg.brandl | 2008-12-27 20:04:44 +0100 (Sat, 27 Dec 2008) | 2 lines
#4695 : fix backslashery.
........
r67961 | georg.brandl | 2008-12-27 20:06:04 +0100 (Sat, 27 Dec 2008) | 2 lines
Use :samp: role.
........
r67963 | georg.brandl | 2008-12-27 20:11:15 +0100 (Sat, 27 Dec 2008) | 2 lines
#4671 : document that pydoc imports modules.
........
r67965 | antoine.pitrou | 2008-12-27 21:34:52 +0100 (Sat, 27 Dec 2008) | 3 lines
Issue #4677 : add two list comprehension tests to pybench.
........
r67967 | benjamin.peterson | 2008-12-27 23:18:58 +0100 (Sat, 27 Dec 2008) | 1 line
fix markup
........
r67970 | alexandre.vassalotti | 2008-12-28 02:52:58 +0100 (Sun, 28 Dec 2008) | 2 lines
Fix name mangling of PyUnicode_ClearFreeList.
........
r67971 | alexandre.vassalotti | 2008-12-28 03:10:35 +0100 (Sun, 28 Dec 2008) | 2 lines
Sort UCS-2/UCS-4 name mangling list.
........
r67973 | alexandre.vassalotti | 2008-12-28 03:58:22 +0100 (Sun, 28 Dec 2008) | 2 lines
Document Py_VaBuildValue.
........
r67982 | benjamin.peterson | 2008-12-28 16:37:31 +0100 (Sun, 28 Dec 2008) | 1 line
fix WORD_BIGEDIAN declaration in Universal builds; fixes #4060 and #4728
........
r67988 | ronald.oussoren | 2008-12-28 20:40:56 +0100 (Sun, 28 Dec 2008) | 1 line
Issue4064: architecture string for universal builds on OSX
........
r67990 | ronald.oussoren | 2008-12-28 20:50:40 +0100 (Sun, 28 Dec 2008) | 3 lines
Update the fix for issue4064 to deal correctly with all three variants of
universal builds that are presented by the configure script.
........
r67995 | benjamin.peterson | 2008-12-28 22:16:07 +0100 (Sun, 28 Dec 2008) | 1 line
#4763 PyErr_ExceptionMatches won't blow up with NULL arguments
........
r68014 | benjamin.peterson | 2008-12-29 18:47:42 +0100 (Mon, 29 Dec 2008) | 1 line
#4764 set IOError.filename when trying to open a directory on POSIX platforms
........
r68016 | benjamin.peterson | 2008-12-29 18:56:58 +0100 (Mon, 29 Dec 2008) | 1 line
#4764 in io.open, set IOError.filename when trying to open a directory on POSIX platforms
........
r68030 | benjamin.peterson | 2008-12-29 22:38:14 +0100 (Mon, 29 Dec 2008) | 1 line
fix French
........
r68057 | vinay.sajip | 2008-12-30 08:01:25 +0100 (Tue, 30 Dec 2008) | 1 line
Minor documentation change relating to NullHandler.
........
r68061 | georg.brandl | 2008-12-30 11:15:49 +0100 (Tue, 30 Dec 2008) | 2 lines
#4778 : attributes can't be called.
........
r68112 | benjamin.peterson | 2009-01-01 00:48:39 +0100 (Thu, 01 Jan 2009) | 1 line
#4795 inspect.isgeneratorfunction() should return False instead of None
........
r68115 | benjamin.peterson | 2009-01-01 05:04:41 +0100 (Thu, 01 Jan 2009) | 1 line
simplfy code
........
r68116 | georg.brandl | 2009-01-01 12:46:51 +0100 (Thu, 01 Jan 2009) | 2 lines
#4100 : note that element children are not necessarily present on "start" events.
........
r68117 | georg.brandl | 2009-01-01 12:53:55 +0100 (Thu, 01 Jan 2009) | 2 lines
#4156 : make clear that "protocol" is to be replaced with the protocol name.
........
r68118 | georg.brandl | 2009-01-01 13:00:19 +0100 (Thu, 01 Jan 2009) | 2 lines
#4185 : clarify escape behavior of replacement strings.
........
r68120 | georg.brandl | 2009-01-01 13:15:31 +0100 (Thu, 01 Jan 2009) | 4 lines
#4228 : Pack negative values the same way as 2.4
in struct's L format.
........
r68121 | georg.brandl | 2009-01-01 13:43:33 +0100 (Thu, 01 Jan 2009) | 2 lines
Point to types module in new module deprecation notice.
........
r68123 | georg.brandl | 2009-01-01 13:52:29 +0100 (Thu, 01 Jan 2009) | 2 lines
#4784 : ... on three counts ...
........
r68124 | georg.brandl | 2009-01-01 13:53:19 +0100 (Thu, 01 Jan 2009) | 2 lines
#4782 : Fix markup error that hid load() and loads().
........
r68125 | georg.brandl | 2009-01-01 14:02:09 +0100 (Thu, 01 Jan 2009) | 2 lines
#4776 : add data_files and package_dir arguments.
........
r68126 | georg.brandl | 2009-01-01 14:05:13 +0100 (Thu, 01 Jan 2009) | 2 lines
Handlers are in the `logging.handlers` module.
........
r68127 | georg.brandl | 2009-01-01 14:14:49 +0100 (Thu, 01 Jan 2009) | 2 lines
#4767 : Use correct submodules for all MIME classes.
........
r68128 | antoine.pitrou | 2009-01-01 15:11:22 +0100 (Thu, 01 Jan 2009) | 3 lines
Issue #3680 : Reference cycles created through a dict, set or deque iterator did not get collected.
........
2009-01-01 15:46:10 +00:00
Brett Cannon
672237dc6c
warnings.catch_warnings() now returns a list or None instead of the custom
...
WarningsRecorder object. This makes the API simpler to use as no special object
must be learned.
Closes issue 3781.
Review by Benjamin Peterson.
2008-09-09 00:49:16 +00:00
Mark Hammond
69ed524045
Fix bug 3625: test issues on 64bit windows. r=pitrou
2008-08-23 00:59:14 +00:00
Nick Coghlan
38469e2719
Make test.test_support.catch_warnings more robust as discussed on python-dev. Also add explicit tests for itto test_warnings.
2008-07-13 12:23:47 +00:00
Gregory P. Smith
a0205d0a46
silence the test when it is skipped on some platforms. should fix a
...
buildbot.
2008-06-14 17:34:09 +00:00
Gregory P. Smith
9d53457e59
Merge in release25-maint r60793:
...
Added checks for integer overflows, contributed by Google. Some are
only available if asserts are left in the code, in cases where they
can't be triggered from Python code.
2008-06-11 07:41:16 +00:00
Benjamin Peterson
d5299866f9
convert test_struct to a unittest thanks to Giampaolo Rodola
...
I had to disable one test because it was functioning incorrectly, see #1530559
I also removed the debugging prints
2008-06-11 01:31:28 +00:00
Mark Dickinson
c23b8a7af9
Issue 705836: Fix struct.pack(">f", 1e40) to behave consistently
...
across platforms: it should now raise OverflowError on all
platforms. (Previously it raised OverflowError only on
non IEEE 754 platforms.)
Also fix the (already existing) test for this behaviour
so that it actually raises TestFailed instead of just
referencing it.
2008-03-14 14:23:37 +00:00
Thomas Heller
f3c0559b5e
Issue 1872: Changed the struct module typecode from 't' to '?', for
...
compatibility with PEP3118.
2008-03-05 15:34:29 +00:00
Brett Cannon
2ee4128e9b
Remove test.test_support.guard_warnings_filter.
...
test.test_support.catch_warning is more full-featured and provides the same
functionality.
Since guard_warnings_filter was added in 2.6 there is no
backwards-compatibility issues.
2007-08-14 05:51:06 +00:00
Raymond Hettinger
7a3d41f4ca
Bug #1563759 : struct.unpack doens't support buffer protocol objects
2007-04-05 18:00:03 +00:00
Tim Peters
f733abb783
Whitespace normalization.
2007-01-30 03:03:46 +00:00
Martin v. Löwis
aef4c6bc00
Patch #1610575 : Add support for _Bool to struct.
2007-01-21 09:33:07 +00:00
Brett Cannon
6d9520c4f0
Add test.test_support.guard_warnings_filter . This function returns a context
...
manager that protects warnings.filter from being modified once the context is
exited.
2006-12-13 23:09:53 +00:00
Bob Ippolito
e6c9f982a0
Fix #1530559 , struct.pack raises TypeError where it used to convert.
...
Passing float arguments to struct.pack when integers are expected
now triggers a DeprecationWarning.
2006-08-04 23:59:21 +00:00
Tim Peters
852eae1bc1
Access _struct attributes directly instead of mucking with getattr.
...
string_reverse(): Simplify.
assertRaises(): Raise TestFailed on failure.
test_unpack_from(), test_pack_into(), test_pack_into_fn(): never
use `assert` to test for an expected result (it doesn't test anything
when Python is run with -O).
2006-06-05 20:48:49 +00:00
Martin Blais
af2ae72cb2
Fixes in struct and socket from merge reviews.
...
- Following Guido's comments, renamed
* pack_to -> pack_into
* recv_buf -> recv_into
* recvfrom_buf -> recvfrom_into
- Made fixes to _struct.c according to Neal Norwitz comments on the checkins
list.
- Converted some ints into the appropriate -- I hope -- ssize_t and size_t.
2006-06-04 13:49:49 +00:00
Tim Peters
c65a13f53b
Whitespace normalization.
2006-06-04 01:22:53 +00:00
Martin Blais
7f7386cfd2
Fixed struct test to not use unittest.
2006-06-02 13:03:43 +00:00
Neal Norwitz
9f16dd026c
On 64-bit platforms running test_struct after test_tarfile would fail
...
since the deprecation warning wouldn't be raised.
2006-05-31 09:02:44 +00:00
Bob Ippolito
4182a75571
Change wrapping terminology to overflow masking
2006-05-30 17:37:54 +00:00
Tim Peters
aba19bc45f
deprecated_err(): Stop bizarre warning messages when the tests
...
are run in the order:
test_genexps (or any other doctest-based test)
test_struct
test_doctest
The `warnings` module needs an advertised way to save/restore
its internal filter list.
2006-05-30 02:25:25 +00:00
Bob Ippolito
2fd3977a9d
struct: modulo math plus warning on all endian-explicit formats for compatibility with older struct usage (ugly)
2006-05-29 22:55:48 +00:00
Bob Ippolito
1fcdc232db
Fix up struct docstrings, add struct.pack_to function for symmetry
2006-05-27 12:11:36 +00:00
Bob Ippolito
aa70a17e13
enable all of the struct tests, use ssize_t, fix some whitespace
2006-05-26 20:25:23 +00:00
Bob Ippolito
e27337b5d0
fix #1229380 No struct.pack exception for some out of range integers
2006-05-26 13:15:44 +00:00
Tim Peters
fe98f9613b
Whitespace normalization.
2006-05-26 12:26:21 +00:00
Martin Blais
2856e5f390
Support for buffer protocol for socket and struct.
...
* Added socket.recv_buf() and socket.recvfrom_buf() methods, that use the buffer
protocol (send and sendto already did).
* Added struct.pack_to(), that is the corresponding buffer compatible method to
unpack_from().
* Fixed minor typos in arraymodule.
2006-05-26 12:03:27 +00:00
Bob Ippolito
eb62127842
refactor unpack, add unpack_from
2006-05-24 15:32:06 +00:00
Armin Rigo
9f90439817
Patch #1011240 : SystemError generated by struct.pack('P', 'foo').
2004-09-27 19:27:51 +00:00
Walter Dörwald
70a6b49821
Replace backticks with repr() or "%r"
...
From SF patch #852334 .
2004-02-12 17:35:32 +00:00
Tim Peters
d50ade68ec
SF bug 705836: struct.pack of floats in non-native endian order
...
pack_float, pack_double, save_float: All the routines for creating
IEEE-format packed representations of floats and doubles simply ignored
that rounding can (in rare cases) propagate out of a long string of
1 bits. At worst, the end-off carry can (by mistake) interfere with
the exponent value, and then unpacking yields a result wrong by a factor
of 2. In less severe cases, it can end up losing more low-order bits
than intended, or fail to catch overflow *caused* by rounding.
Bugfix candidate, but I already backported this to 2.2.
In 2.3, this code remains in severe need of refactoring.
2003-03-20 18:32:13 +00:00
Guido van Rossum
68468eba63
Get rid of many apply() calls.
2003-02-27 20:14:51 +00:00
Barry Warsaw
04f357cffe
Get rid of relative imports in all unittests. Now anything that
...
imports e.g. test_support must do so using an absolute package name
such as "import test.test_support" or "from test import test_support".
This also updates the README in Lib/test, and gets rid of the
duplicate data dirctory in Lib/test/data (replaced by
Lib/email/test/data).
Now Tim and Jack can have at it. :)
2002-07-23 19:04:11 +00:00
Tim Peters
0891ac017d
The 'p' (Pascal string) pack code acts unreasonably when the string size
...
and count exceed 255. Changed to preserve as much of the string as
possible (instead of count%256 characters).
2001-09-15 02:35:15 +00:00
Tim Peters
3eec38af37
Added "i" and "l" to the list of std-mode struct codes that don't range-
...
check correctly on pack(). While these were checking OK on my 32-bit box,
Mark Favas reported failures on a 64-bit box (alas, easy to believe).
2001-06-18 22:27:39 +00:00
Tim Peters
17e17d4406
Generalize the new qQ std-mode tests to all int codes (bBhHiIlLqQ).
...
Unfortunately, the std-mode bBhHIL codes don't do any range-checking; if
and when some of those get fixed, remove their letters from the
IntTester.BUGGY_RANGE_CHECK string. In the meantime, a msg saying that
range-tests are getting skipped is printed to stdout whenever one is
skipped.
2001-06-13 22:45:27 +00:00
Tim Peters
da9c5b35a3
The new {b,l}p_{u,}longlong() didn't check get_pylong()'s return for NULL.
...
Repaired that, and added appropriate tests for it to test_struct.py.
2001-06-13 01:26:35 +00:00
Tim Peters
7a3bfc3a47
Added q/Q standard (x-platform 8-byte ints) mode in struct module.
...
This completes the q/Q project.
longobject.c _PyLong_AsByteArray: The original code had a gross bug:
the most-significant Python digit doesn't necessarily have SHIFT
significant bits, and you really need to count how many copies of the sign
bit it has else spurious overflow errors result.
test_struct.py: This now does exhaustive std q/Q testing at, and on both
sides of, all relevant power-of-2 boundaries, both positive and negative.
NEWS: Added brief dict news while I was at it.
2001-06-12 01:22:22 +00:00
Tim Peters
c533edceb1
Renamed some stuff to tell the truth about what it does.
2001-06-10 23:52:59 +00:00
Tim Peters
7b9542a3f7
Initial support for 'q' and 'Q' struct format codes: for now, only in
...
native mode, and only when config #defines HAVE_LONG_LONG. Standard mode
will eventually treat them as 8-byte ints across all platforms, but that
likely requires a new set of routines in longobject.c first (while
sizeof(long) >= 4 is guaranteed by C, there's nothing in C we can rely
on x-platform to hold 8 bytes of int, so we'll have to roll our own;
I'm thinking of a simple pair of conversion functions, Python long
to/from sized vector of unsigned bytes; that may be useful for GMP
conversions too; std q/Q would call them with size fixed at 8).
test_struct.py: In addition to adding some native-mode 'q' and 'Q' tests,
got rid of unused code, and repaired a non-portable assumption about
native sizeof(short) (it isn't 2 on some Cray boxes).
libstruct.tex: In addition to adding a bit of 'q'/'Q' docs (more needed
later), removed an erroneous footnote about 'I' behavior.
2001-06-10 23:40:19 +00:00
Fred Drake
132dce2246
Update the code to better reflect recommended style:
...
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
2000-12-12 23:11:42 +00:00
Fred Drake
004d5e6880
Make reindent.py happy (convert everything to 4-space indents!).
2000-10-23 17:22:08 +00:00
Guido van Rossum
41360a4696
Mass check-in after untabifying all files that need it.
1998-03-26 19:42:58 +00:00
Guido van Rossum
04ebf5ca5d
Change the ``calcsize*3'' test to be portable to 64-bit machines.
1997-01-03 19:00:37 +00:00
Guido van Rossum
420c11c6aa
Added f/d tests for specific byte orders.
1997-01-03 00:09:46 +00:00
Guido van Rossum
2a37850273
Exercise the new feature set somewhat.
...
Use TestFailed exception and verbose flag from test_support module.
1996-12-31 17:25:47 +00:00
Barry Warsaw
07a0eeceaa
A test of the struct module
1996-12-12 23:34:06 +00:00