Skip to content

Commit

Permalink
Add changes to README and CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
jonded94 committed Aug 5, 2024
1 parent 00a4ab6 commit 685a413
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Development

* Release GIL during the computation of the CRC32C hash.
* Added new parameter `gil_release_mode` for either keeping the GIL as long as given data is less than 32KiB or always releasing or keeping it
* Allow `kwargs` in general (buffer is given with `data`, initial CRC value with `value` and GIL release mode with `gil_release_mode`)
* Adding explicit fallthrough annotations
in several ``switch`` C statements
for clarity, and to avoid potential warnings (#46).
Expand Down
15 changes: 12 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ by older compiler versions.
Usage
-----

The only method exposed by this module is ``crc32c(data, [crc])``.
The only method exposed by this module is ``crc32c(data, [value])``.
It computes the CRC32C checksum of ``data``
starting with an initial ``crc`` checksum,
starting with an initial ``value`` checksum,
similarly to how the built-in ``binascii.crc32`` works.
It can thus be used like this:

Expand All @@ -40,14 +40,23 @@ It can thus be used like this:
print(crc32c.crc32c(b'hello world'))
# 3381945770
crc = crc32c.crc32c(b'hello')
print(crc32c.crc32c(b' world', crc))
print(crc32c.crc32c(b' world', value=crc))
# 3381945770
In older versions,
the function exposed by this module was called ``crc32``.
That name is still present but deprecated,
and will be removed in new versions of the library.

There is another keyword argument called ``gil_release_mode``
which specifies whether a call of this library shall release
or keep the GIL (https://wiki.python.org/moin/GlobalInterpreterLock).
It can be set to these values:

* -1 (or less): Automatic mode, i.e. keep the GIL as long as given data buffer is less than 32KiB
* 0: Always keep the GIL
* 1: Always release the GIL

Additionally one can consult
the following module-level values:

Expand Down

0 comments on commit 685a413

Please sign in to comment.