Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r789:9cffd03b74f3 Date: 2012-08-07 11:16 +0200 http://bitbucket.org/cffi/cffi/changeset/9cffd03b74f3/
Log: Tentative: allow load_library(None). diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -2492,7 +2492,11 @@ DynLibObject *dlobj; int is_global = 0; - if (!PyArg_ParseTuple(args, "et|i:load_library", + if (PyTuple_GET_SIZE(args) == 0 || PyTuple_GET_ITEM(args, 0) == Py_None) { + filename = NULL; + is_global = 1; + } + else if (!PyArg_ParseTuple(args, "et|i:load_library", Py_FileSystemDefaultEncoding, &filename, &is_global)) return NULL; @@ -2509,7 +2513,7 @@ return NULL; } dlobj->dl_handle = handle; - dlobj->dl_name = strdup(filename); + dlobj->dl_name = strdup(filename ? filename : "<None>"); return (PyObject *)dlobj; } _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit