Commit Graph

105 Commits

Author SHA1 Message Date
Victor Stinner e84c976568 Issue #25357: Add an optional newline paramer to binascii.b2a_base64().
base64.b64encode() uses it to avoid a memory copy.
2015-10-11 11:01:02 +02:00
Gregory P. Smith 9c6b916662 Switch binascii over to using the common _Py_strhex implementation for its hex
and hexlify functions.  issue9951.
2015-04-26 00:42:13 +00:00
Serhiy Storchaka e3037e1145 Issue #23728: binascii.crc_hqx() could return an integer outside of the range
0-0xffff for empty data.
2015-04-20 09:31:51 +03:00
Serhiy Storchaka 2ef7c47844 Issue #23728: binascii.crc_hqx() could return an integer outside of the range
0-0xffff for empty data.
2015-04-20 09:26:49 +03:00
Larry Hastings 89964c48d1 Issue #23944: Argument Clinic now wraps long impl prototypes at column 78. 2015-04-14 18:07:59 -04:00
Serhiy Storchaka 1009bf18b3 Issue #23501: Argumen Clinic now generates code into separate files by default. 2015-04-03 23:53:51 +03:00
Berker Peksag 3cd30c2cee Issue #13637: Improve exception message of a2b_* functions.
Patch by Vajrasky Kok.
2015-02-15 00:31:00 +02:00
Zachary Ware b176d40398 Issue #23280: Fix docstrings for binascii.(un)hexlify 2015-01-20 13:59:46 -06:00
Larry Hastings 581ee3618c Issue #20326: Argument Clinic now uses a simple, unique signature to
annotate text signatures in docstrings, resulting in fewer false
positives.  "self" parameters are also explicitly marked, allowing
inspect.Signature() to authoritatively detect (and skip) said parameters.

Issue #20326: Argument Clinic now generates separate checksums for the
input and output sections of the block, allowing external tools to verify
that the input has not changed (and thus the output is not out-of-date).
2014-01-28 05:00:08 -08:00
Benjamin Peterson b62deac9a3 cleanup after custom buffer converter 2014-01-26 10:41:58 -05:00
Larry Hastings f256c22f34 Fix for catestrophic errors in previous checkin (Argument Clinic rollup patch). 2014-01-25 21:30:37 -08:00
Serhiy Storchaka 12785617c8 Fixed converting errors in the binascii module (issue20151).
a2b_qp() now accepts keyword arguments.
All "ascii" parameters is renamed to "data" for consistancy with a2b_qp().
2014-01-25 11:49:49 +02:00
Serhiy Storchaka 3ffd913d66 Issue #20151: The binascii module now uses Argument Clinic. 2014-01-25 11:21:23 +02:00
R David Murray c3f57e4a35 Merge #19411: Clarify that b2a_hex/hexlify returns a bytes object. 2013-11-03 13:22:17 -05:00
R David Murray 5fdb64b5a0 #19411: Clarify that b2a_hex/hexlify returns a bytes object.
Initial patch by Vajrasky Kok.
2013-11-03 13:21:38 -05:00
Victor Stinner 7979926616 Issue #18408: Fix usage of _PyBytes_Resize()
_PyBytes_Resize(&v, new_size) sets v to NULL on error, so v cannot be used
anymore. Replace "Py_DECREF(v); v = NULL;" with "Py_CLEAR(v);".
2013-07-09 00:35:22 +02:00
Antoine Pitrou c73c561181 Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.
I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag), mpdecimal (needs to build without Python.h).
2013-02-09 23:14:42 +01:00
Antoine Pitrou 4de7457009 Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.
I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag).
2013-02-09 23:11:27 +01:00
Antoine Pitrou 0831676962 Issue #13637: "a2b" functions in the binascii module now accept ASCII-only unicode strings. 2011-12-20 13:58:41 +01:00
Victor Stinner f5cff56a1b Issue #13088: Add shared Py_hexdigits constant to format a number into base 16 2011-10-14 02:13:11 +02:00
Antoine Pitrou ed8ba14441 Remove all other uses of the C tolower()/toupper() which could break with a Turkish locale. 2011-10-04 13:50:21 +02:00
Senthil Kumaran 922e904cca Fix issue10324 - Modules/binascii.c: simplify expressions 2010-11-09 09:59:13 +00:00
Antoine Pitrou 4045575dd5 Fix more 64-bit warnings. 2010-08-15 18:51:10 +00:00
Antoine Pitrou 22e4155706 Fix other warnings under 64-bit Windows. 2010-08-15 18:07:50 +00:00
Florent Xicluna f1046ca817 Issue #4770: Restrict binascii module to accept only bytes (as specified).
And fix the email package to encode to ASCII instead of ``raw-unicode-escape`` before ASCII-to-binary decoding.
2010-07-27 21:20:15 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Antoine Pitrou 9f96ffc8b9 Remove duplicated line when merging (it was even valid C!).
Thanks Florent for noticing.
2010-01-16 18:15:15 +00:00
Antoine Pitrou 747e8b3f58 Merged revisions 77528 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77528 | antoine.pitrou | 2010-01-16 18:45:56 +0100 (sam., 16 janv. 2010) | 4 lines

  Followup to #7703: a2b_hqx() didn't follow the new buffer API (neither in trunk
  nor in py3k).  Patch by Florent Xicluna as well as additional tests.
........
2010-01-16 17:55:52 +00:00
Antoine Pitrou 2843aa8f53 Merged revisions 77506 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77506 | antoine.pitrou | 2010-01-15 01:18:00 +0100 (ven., 15 janv. 2010) | 4 lines

  Issue #7701: Fix crash in binascii.b2a_uu() in debug mode when given a
  1-byte argument.  Patch by Victor Stinner.
........
2010-01-15 00:27:43 +00:00
Amaury Forgeot d'Arc bc9d4749f2 #4542: On Windows, binascii.crc32 still accepted str as binary input.
This fixes test_binascii.

Will backport to 3.0
2008-12-05 01:40:43 +00:00
Martin v. Löwis 15b16a3ec4 Issue #4387: binascii now refuses to accept str as binary input. 2008-12-02 06:00:15 +00:00
Benjamin Peterson 9edd2bd35c Fix #3651 various memory leaks when using the buffer interface
by Amaury Forgeot d'Arc
Reviewer: Antoine Pitrou
2008-08-27 00:31:37 +00:00
Antoine Pitrou 34ed9f7c5e Fix building binascii when not using the zlib's crc32 (build failure on Windows buildbots) 2008-08-15 14:51:48 +00:00
Martin v. Löwis 423be95dcf Merged revisions 65654 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r65654 | martin.v.loewis | 2008-08-12 16:49:50 +0200 (Tue, 12 Aug 2008) | 6 lines

  Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,
  by denying s# to parse objects that have a releasebuffer procedure,
  and introducing s*.

  More module might need to get converted to use s*.
........
2008-08-13 15:53:07 +00:00
Amaury Forgeot d'Arc 9c74b14fe9 Merged revisions 64114 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r64114 | gregory.p.smith | 2008-06-11 09:41:16 +0200 (mer., 11 juin 2008) | 6 lines

  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-18 00:47:36 +00:00
Martin v. Löwis 1a21451b1d Implement PEP 3121: new module initialization and finalization API. 2008-06-11 05:26:20 +00:00
Christian Heimes 72b710a596 Renamed PyString to PyBytes 2008-05-26 13:28:38 +00:00
Christian Heimes cc47b05fe5 Merged revisions 61834,61841-61842,61851-61853,61863-61864,61869-61870,61874,61889 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r61834 | raymond.hettinger | 2008-03-24 07:07:49 +0100 (Mon, 24 Mar 2008) | 1 line

  Tighten documentation for Random.triangular.
........
  r61841 | raymond.hettinger | 2008-03-24 09:17:39 +0100 (Mon, 24 Mar 2008) | 1 line

  Issue 2460: Make Ellipsis objects copyable.
........
  r61842 | georg.brandl | 2008-03-24 10:34:34 +0100 (Mon, 24 Mar 2008) | 2 lines

  #1700821: add a note to audioop docs about signedness of sample formats.
........
  r61851 | christian.heimes | 2008-03-24 20:57:42 +0100 (Mon, 24 Mar 2008) | 1 line

  Added quick hack for bzr
........
  r61852 | christian.heimes | 2008-03-24 20:58:17 +0100 (Mon, 24 Mar 2008) | 1 line

  Added quick hack for bzr
........
  r61853 | amaury.forgeotdarc | 2008-03-24 22:04:10 +0100 (Mon, 24 Mar 2008) | 4 lines

  Issue2469: Correct a typo I introduced at r61793: compilation error with UCS4 builds.

  All buildbots compile with UCS2...
........
  r61863 | neal.norwitz | 2008-03-25 05:17:38 +0100 (Tue, 25 Mar 2008) | 2 lines

  Fix a bunch of UnboundLocalErrors when the tests fail.
........
  r61864 | neal.norwitz | 2008-03-25 05:18:18 +0100 (Tue, 25 Mar 2008) | 2 lines

  Try to fix a bunch of compiler warnings on Win64.
........
  r61869 | neal.norwitz | 2008-03-25 07:35:10 +0100 (Tue, 25 Mar 2008) | 3 lines

  Don't try to close a non-open file.
  Don't let file removal cause the test to fail.
........
  r61870 | neal.norwitz | 2008-03-25 08:00:39 +0100 (Tue, 25 Mar 2008) | 7 lines

  Try to get this test to be more stable:
   * disable gc during the test run because we are spawning objects and there
     was an exception when calling Popen.__del__
   * Always set an alarm handler so the process doesn't exit if the test fails
     (should probably add assertions on the value of hndl_called in more places)
   * Using a negative time causes Linux to treat it as zero, so disable that test.
........
  r61874 | gregory.p.smith | 2008-03-25 08:31:28 +0100 (Tue, 25 Mar 2008) | 2 lines

  Use a 32-bit unsigned int here, a long is not needed.
........
  r61889 | georg.brandl | 2008-03-25 12:59:51 +0100 (Tue, 25 Mar 2008) | 2 lines

  Move declarations to block start.
........
2008-03-25 14:56:36 +00:00
Gregory P. Smith 3c0e4d2304 Merge the table type change to save space on LP64 platforms from trunk r61875. 2008-03-25 07:51:12 +00:00
Neal Norwitz 4027bf8794 Fix crash on 64-bit platforms 2008-03-24 04:59:05 +00:00
Christian Heimes 1dc5400939 Merged revisions 61820-61823 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r61820 | gregory.p.smith | 2008-03-23 23:14:38 +0100 (Sun, 23 Mar 2008) | 2 lines

  replace calls to get the initial values with the raw constants.
........
  r61821 | gregory.p.smith | 2008-03-24 00:43:02 +0100 (Mon, 24 Mar 2008) | 2 lines

  A bugfix for r61813, it would fail if the data size was >=2**32.
........
  r61822 | gregory.p.smith | 2008-03-24 00:45:12 +0100 (Mon, 24 Mar 2008) | 2 lines

  prevent a warning from the struct module when data size >= 2**32.
........
  r61823 | gregory.p.smith | 2008-03-24 01:08:01 +0100 (Mon, 24 Mar 2008) | 4 lines

  Have the binascii module use zlib's optimized crc32() function when available
  to reduce our code size (1k data table and tiny bit of code).  It falls back
  to its own without zlib.
........
2008-03-24 02:19:29 +00:00
Gregory P. Smith 2727503bc9 crc32 always returns unsigned. cleanup the code a bit and revert r61648 with
the proper fix.
2008-03-20 06:20:09 +00:00
Christian Heimes d5e2b6f3bc Merged revisions 61538-61540,61556,61559-61560,61563,61565,61571,61575-61576,61580-61582,61586,61591,61593,61595,61605-61606,61613-61616,61618,61621-61623,61625,61627,61631-61634 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r61538 | steven.bethard | 2008-03-18 20:03:50 +0100 (Di, 18 Mär 2008) | 1 line

  cell_compare needs to return -2 instead of NULL.
........
  r61539 | steven.bethard | 2008-03-18 20:04:32 +0100 (Di, 18 Mär 2008) | 1 line

  _have_soundcard() is a bad check for winsound.Beep, since you can have a soundcard but have the beep driver disabled. This revision basically disables the beep tests by wrapping them in a try/except. The Right Way To Do It is to come up with a _have_enabled_beep_driver() and use that.
........
  r61540 | gregory.p.smith | 2008-03-18 20:05:32 +0100 (Di, 18 Mär 2008) | 8 lines

  Fix chown on 64-bit linux.  It needed to take a long (64-bit on 64bit linux) as
  uid and gid input to accept values >=2**31 as valid while still accepting
  negative numbers to pass -1 to chown for "no change".

  Fixes issue1747858.

  This should be backported to release25-maint.
........
  r61556 | steven.bethard | 2008-03-18 20:59:14 +0100 (Di, 18 Mär 2008) | 1 line

  Fix test_atexit so that it still passes when -3 is supplied. (It was catching the warning messages on stdio from using the reload() function.)
........
  r61559 | neal.norwitz | 2008-03-18 21:30:38 +0100 (Di, 18 Mär 2008) | 1 line

  Import the test properly.  This is especially important for py3k.
........
  r61560 | gregory.p.smith | 2008-03-18 21:40:01 +0100 (Di, 18 Mär 2008) | 2 lines

  news entry for the chown fix
........
  r61563 | brett.cannon | 2008-03-18 22:12:42 +0100 (Di, 18 Mär 2008) | 2 lines

  Ignore BIG5HKSCS-2004.TXT which is downloaded as part of a test.
........
  r61565 | steven.bethard | 2008-03-18 22:30:13 +0100 (Di, 18 Mär 2008) | 1 line

  Have regrtest skip test_py3kwarn when the -3 flag is missing.
........
  r61571 | gregory.p.smith | 2008-03-18 23:27:41 +0100 (Di, 18 Mär 2008) | 4 lines

  Add a test to make sure zlib.crc32 and binascii.crc32 return the same thing.
  Fix a buglet in binascii.crc32, the second optional argument could previously
  have a signedness mismatch with the C variable its going into.
........
  r61575 | raymond.hettinger | 2008-03-19 00:22:29 +0100 (Mi, 19 Mär 2008) | 1 line

  Speed-up isinstance() for one easy case.
........
  r61576 | raymond.hettinger | 2008-03-19 00:33:08 +0100 (Mi, 19 Mär 2008) | 1 line

  Issue: 2354: Add 3K warning for the cmp argument to list.sort() and sorted().
........
  r61580 | andrew.kuchling | 2008-03-19 02:05:35 +0100 (Mi, 19 Mär 2008) | 1 line

  Add Jeff Rush
........
  r61581 | gregory.p.smith | 2008-03-19 02:38:35 +0100 (Mi, 19 Mär 2008) | 3 lines

  Mention that crc32 and adler32 are available in a different module (zlib).
  Some people look for them in hashlib.
........
  r61582 | gregory.p.smith | 2008-03-19 02:46:10 +0100 (Mi, 19 Mär 2008) | 3 lines

  Use zlib's crc32 routine instead of binascii when available.  zlib's is faster
  when compiled properly optimized and about the same speed otherwise.
........
  r61586 | david.wolever | 2008-03-19 03:26:57 +0100 (Mi, 19 Mär 2008) | 1 line

  Added my name to ACKS
........
  r61591 | gregory.p.smith | 2008-03-19 04:14:41 +0100 (Mi, 19 Mär 2008) | 5 lines

  Fix the struct module DeprecationWarnings that zipfile was triggering by
  removing all use of signed struct values.

  test_zipfile and test_zipfile64 pass.  no more warnings.
........
  r61593 | raymond.hettinger | 2008-03-19 04:56:59 +0100 (Mi, 19 Mär 2008) | 1 line

  Fix compiler warning.
........
  r61595 | martin.v.loewis | 2008-03-19 05:39:13 +0100 (Mi, 19 Mär 2008) | 2 lines

  Issue #2400: Allow relative imports to "import *".
........
  r61605 | martin.v.loewis | 2008-03-19 07:00:28 +0100 (Mi, 19 Mär 2008) | 2 lines

  Import relimport using a relative import.
........
  r61606 | trent.nelson | 2008-03-19 07:28:24 +0100 (Mi, 19 Mär 2008) | 1 line

  Issue2290: Support x64 Windows builds that live in pcbuild/amd64.  Without it, sysutils._python_build() returns the wrong directory, which causes the test_get_config_h_filename method in Lib/distutils/tests/test_sysconfig.py to fail.
........
  r61613 | trent.nelson | 2008-03-19 08:45:19 +0100 (Mi, 19 Mär 2008) | 3 lines

  Refine the Visual Studio 2008 build solution in order to improve how we deal with external components, as well as fixing outstanding issues with Windows x64 build support.  Introduce two new .vcproj files, _bsddb44.vcproj and sqlite3.vcproj, which replace the previous pre-link event scripts for _bsddb and _sqlite3 respectively.  The new project files inherit from our property files as if they were any other Python module.  This has numerous benefits.  First, the components get built with exactly the same compiler flags and settings as the rest of Python.  Second, it makes it much easier to debug problems in the external components when they're part of the build system.  Third, they'll benefit from profile guided optimisation in the release builds, just like the rest of Python core.

  I've also introduced a slightly new pattern for managing externals in subversion.  New components get checked in as <name>-<version>.x, where <version> matches the exact vendor version string.  After the initial import of the external component, the .x is tagged as .0 (i.e. tcl-8.4.18.x -> tcl-8.4.18.0).  Some components may not need any tweaking, whereas there are others that might (tcl/tk fall into this bucket).  In that case, the relevant modifications are made to the .x branch, which will be subsequently tagged as .1 (and then n+1 going forward) when they build successfully and all tests pass.  Buildbots will be converted to rely on these explicit tags only, which makes it easy for us to switch them over to a new version as and when required.  (Simple change to external(-amd64).bat: if we've bumped tcl to 8.4.18.1, change the .bat to rmdir 8.4.18.0 if it exists and check out a new .1 copy.)
........
  r61614 | trent.nelson | 2008-03-19 08:56:39 +0100 (Mi, 19 Mär 2008) | 1 line

  Remove extraneous apostrophe and semi-colon from AdditionalIncludeDirectories.
........
  r61615 | georg.brandl | 2008-03-19 08:56:40 +0100 (Mi, 19 Mär 2008) | 2 lines

  Remove footnote from versionchanged as it upsets LaTeX.
........
  r61616 | georg.brandl | 2008-03-19 08:57:57 +0100 (Mi, 19 Mär 2008) | 2 lines

  Another one.
........
  r61618 | trent.nelson | 2008-03-19 09:06:03 +0100 (Mi, 19 Mär 2008) | 1 line

  Fix the tcl-8.4.18.1 path and make sure we cd into the right directory when building tcl/tk.
........
  r61621 | trent.nelson | 2008-03-19 10:23:08 +0100 (Mi, 19 Mär 2008) | 1 line

  Lets have another try at getting the Windows buildbots in a consistent state before rebuilding using the new process.
........
  r61622 | eric.smith | 2008-03-19 13:09:55 +0100 (Mi, 19 Mär 2008) | 2 lines

  Use test.test_support.captured_stdout instead of a custom contextmanager.
  Thanks Nick Coghlan.
........
  r61623 | eric.smith | 2008-03-19 13:15:10 +0100 (Mi, 19 Mär 2008) | 1 line

  Trivial typo.
........
  r61625 | thomas.heller | 2008-03-19 17:10:57 +0100 (Mi, 19 Mär 2008) | 2 lines

  Checkout sqlite-source when it is not there.
........
  r61627 | brett.cannon | 2008-03-19 17:50:13 +0100 (Mi, 19 Mär 2008) | 5 lines

  test_nis would fail if test.test_support.verbose was true but NIS was not set
  up on the machine.

  Closes issue2411. Thanks Michael Bishop.
........
  r61631 | brett.cannon | 2008-03-19 18:37:43 +0100 (Mi, 19 Mär 2008) | 2 lines

  Use sys.py3kwarning instead of trying to trigger a Py3k-related warning.
........
  r61632 | raymond.hettinger | 2008-03-19 18:45:19 +0100 (Mi, 19 Mär 2008) | 1 line

  Issue 2354: Fix-up compare warning.  Patch contributed by Jeff Balogh.
........
  r61633 | raymond.hettinger | 2008-03-19 18:58:59 +0100 (Mi, 19 Mär 2008) | 1 line

  The filter() function does support a None argument in Py3.0.
........
  r61634 | raymond.hettinger | 2008-03-19 19:01:58 +0100 (Mi, 19 Mär 2008) | 1 line

  Remove itertools warnings I had added before the 2-to-3 handled the migration.
........
2008-03-19 21:50:51 +00:00
Christian Heimes 217cfd1c86 Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h 2007-12-02 14:31:20 +00:00
Guido van Rossum 98297ee781 Merging the py3k-pep3137 branch back into the py3k branch.
No detailed change log; just check out the change log for the py3k-pep3137
branch.  The most obvious changes:

  - str8 renamed to bytes (PyString at the C level);
  - bytes renamed to buffer (PyBytes at the C level);
  - PyString and PyUnicode are no longer compatible.

I.e. we now have an immutable bytes type and a mutable bytes type.

The behavior of PyString was modified quite a bit, to make it more
bytes-like.  Some changes are still on the to-do list.
2007-11-06 21:34:58 +00:00
Guido van Rossum fe096d2e2d Remove unused variable. 2007-08-23 18:31:24 +00:00
Neal Norwitz 56dc955049 Use a newer API for creating the module so we don't have to create
the docstring manually.  Saves code and a call to PyString_FromString.
2007-08-23 17:55:33 +00:00
Walter Dörwald 1a0270f64a Remove unused code. 2007-06-11 21:48:58 +00:00
Guido van Rossum 4581ae5fa2 Make test_base64 pass.
Change binascii.Error to derive from ValueError
and raise binascii.Error everywhere where values are bad
(why on earth did the old code use TypeError?!?).
2007-05-22 21:56:47 +00:00
Guido van Rossum 0e225aa09b Make binascii use byte strings everywhere (in and out). 2007-05-22 20:24:57 +00:00