Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zlib_into
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dataAnalysis
zlib_into
Commits
8cd15986
Commit
8cd15986
authored
2 months ago
by
Thomas Kluyver
Browse files
Options
Downloads
Patches
Plain Diff
Support keyword & optional args
parent
9ecabdb4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
try.py
+1
-1
1 addition, 1 deletion
try.py
zlib_into.c
+7
-5
7 additions, 5 deletions
zlib_into.c
with
8 additions
and
6 deletions
try.py
+
1
−
1
View file @
8cd15986
...
...
@@ -3,7 +3,7 @@ import zlib_into
a
=
b
'
abcde
'
*
5000
b
=
bytearray
(
5000
)
res
=
zlib_into
.
compress_into
(
a
,
b
,
1
,
15
)
res
=
zlib_into
.
compress_into
(
a
,
b
,
level
=
9
)
print
(
"
res
"
,
res
)
print
(
b
[:
res
])
...
...
This diff is collapsed.
Click to expand it.
zlib_into.c
+
7
−
5
View file @
8cd15986
...
...
@@ -59,14 +59,16 @@ zlib_error(z_stream zst, int err, const char *msg)
}
static
PyObject
*
compress_into
(
PyObject
*
module
,
PyObject
*
args
)
{
compress_into
(
PyObject
*
module
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
static
char
*
keywords
[]
=
{
"data"
,
"output"
,
"level"
,
"wbits"
,
NULL
};
PyObject
*
return_value
=
NULL
;
Py_buffer
input
,
output
;
Py_ssize_t
bytes_written
;
int
level
,
wbits
;
Py_buffer
input
,
output
;
int
level
=
Z_DEFAULT_COMPRESSION
,
wbits
=
MAX_WBITS
;
z_stream
zst
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*w*ii"
,
&
input
,
&
output
,
&
level
,
&
wbits
))
{
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"y*w*|ii"
,
keywords
,
&
input
,
&
output
,
&
level
,
&
wbits
))
{
return
NULL
;
}
...
...
@@ -131,7 +133,7 @@ compress_into(PyObject *module, PyObject *args) {
}
static
PyMethodDef
ZlibIntoMethods
[]
=
{
{
"compress_into"
,
compress_into
,
METH_VARARGS
,
"zlib compress data into a buffer"
},
{
"compress_into"
,
(
PyCFunction
)
compress_into
,
METH_VARARGS
|
METH_KEYWORDS
,
"zlib compress data into a buffer"
},
{
NULL
,
NULL
,
0
,
NULL
}
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment