text
stringlengths
79
3.72M
<vulnerable_code> if hasattr(select, 'epoll'): class EpollSelector(_PollLikeSelector): """Epoll-based selector.""" _selector_cls = select.epoll # epoll_wait() expects `maxevents` to be greater than zero; # we want to make sure that `select()` can be called when no ...
<vulnerable_code>operate on bytecodes (e.g. peephole optimizers). """ __all__ = ["cmp_op", "hasarg", "hasconst", "hasname", "hasjrel", "hasjabs", "haslocal", "hascompare", "hasfree", "hasexc", "opname", "opmap", "stack_effect", "HAVE_ARGUMENT", "EXTENDED_ARG"] from _opcode import stack_effect i...
<vulnerable_code>from _opcode import stack_effect class OpcodeTests(unittest.TestCase): def check_bool_function_result(self, func, ops, expected): for op in ops: if isinstance(op, str): op = dis.opmap[op] with self.subTest(opcode=op, func=func): sel...
<vulnerable_code> /*[clinic input] _opcode.get_specialization_stats Return the specialization stats _OPCODE_HAS_CONST_METHODDEF _OPCODE_HAS_NAME_METHODDEF _OPCODE_HAS_JUMP_METHODDEF _OPCODE_GET_SPECIALIZATION_STATS_METHODDEF {NULL, NULL, 0, NULL} };<commit_title>[PATCH 016/395] Small fixes to code...
<vulnerable_code> _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { next_instr--; _Py_Specialize_BinaryOp(lhs, rhs, next_instr, oparg, &GETLOCAL(0)); DISPATCH_SAME_OPARG(); } ...
<vulnerable_code> return OPCODE_HAS_JUMP(opcode); } static int codegen_addop_noarg(instr_sequence *seq, int opcode, location loc) {<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-106706...
<vulnerable_code> opcode = get_python_module_dict(opcode_py) opmap = opcode['opmap'] opname = opcode['opname'] hasarg = opcode['hasarg'] hasconst = opcode['hasconst'] hasjrel = opcode['hasjrel'] hasjabs = opcode['hasjabs'] is_pseudo = opcode['is_pseudo'] _pseudo_ops = opcode['_pseudo_...
<vulnerable_code> HAS_CONST_FLAG: bool HAS_NAME_FLAG: bool HAS_JUMP_FLAG: bool def __post_init__(self): self.bitmask = { @staticmethod def fromInstruction(instr: "AnyInstruction"): return InstructionFlags( HAS_ARG_FLAG=variable_used(instr, "oparg"), HAS_C...
<vulnerable_code>{ #define MOD_ADD(name, expr) \ do { \ PyObject *obj = (expr); \ if (obj == NULL) { \ return -1; \ } \ if (PyModule_AddObjectRef(mod, name, obj) < 0) { \ Py_DECREF(obj); \ return -1; \ } \ Py_DECREF(obj); \ } wh...
<vulnerable_code> */ PyModuleDef *mdef; PyMethodDef *fdef; PyObject *proxy; PyObject *func, *name_obj; _hashlibstate *state = get_hashlib_state(module); } } proxy = PyDictProxy_New(state->constructs); if (proxy == NULL) { return -1; } int rc = PyModule_AddO...
<vulnerable_code>_json_exec(PyObject *module) { PyObject *PyScannerType = PyType_FromSpec(&PyScannerType_spec); if (PyScannerType == NULL) { return -1; } int rc = PyModule_AddObjectRef(module, "make_scanner", PyScannerType); Py_DECREF(PyScannerType); if (rc < 0) { return -1; ...
<vulnerable_code> #define ADD_ULONG_CONSTANT(module, name, value) \ do { \ PyObject *o = PyLong_FromUnsignedLong(value); \ if (!o) \ goto error; \ ...
<vulnerable_code>sslmodule_add_option(PyObject *m, const char *name, uint64_t value) { Py_BUILD_ASSERT(sizeof(unsigned long long) >= sizeof(value)); PyObject *obj = PyLong_FromUnsignedLongLong(value); if (obj == NULL) { return -1; } int res = PyModule_AddObjectRef(m, name, obj); Py_DECRE...
<vulnerable_code> PyObject *v; #ifdef WITH_PYMALLOC v = Py_NewRef(Py_True); #else v = Py_NewRef(Py_False); #endif int rc = PyModule_AddObjectRef(mod, "WITH_PYMALLOC", v); Py_DECREF(v); if (rc < 0) { return -1; } <commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<co...
<vulnerable_code>static int add_func_event(PyObject *module, const char *name, PyFunction_WatchEvent event) { PyObject *value = PyLong_FromLong(event); if (value == NULL) { return -1; } int ok = PyModule_AddObjectRef(module, name, value); Py_DECREF(value); return ok; } static PyObject *...
<vulnerable_code> } double d = _PyTime_AsSecondsDouble(state->initialized); PyObject *initialized = PyFloat_FromDouble(d); if (initialized == NULL) { return -1; } int rc = PyModule_AddObjectRef(module, "_module_initialized", initialized); Py_DECREF(initialized); if (rc < 0) { ...
<vulnerable_code> goto error; } int rc = PyModule_AddObjectRef(errors_module, "codes", codes_dict); Py_CLEAR(codes_dict); if (rc < 0) { goto error; } rc = PyModule_AddObjectRef(errors_module, "messages", rev_codes_dict); Py_CLEAR(rev_codes_dict); if (rc < 0) { go...
<vulnerable_code> sock_free_api(capi); goto error; } int rc = PyModule_AddObjectRef(m, PySocket_CAPI_NAME, capsule); Py_DECREF(capsule); if (rc < 0) { goto error; } }; int i; for (i = 0; i < Py_ARRAY_LENGTH(codes); ++i) { PyObject *tmp = Py...
<vulnerable_code> } /* Export C API */ PyObject *capsule = unicodedata_create_capi(); if (capsule == NULL) { return -1; } int rc = PyModule_AddObjectRef(module, "_ucnhash_CAPI", capsule); Py_DECREF(capsule); if (rc < 0) { return -1; } return 0;<commit_title>[PATCH...
<vulnerable_code>}; static int insertptr(PyObject *mod, char *name, void *value) { PyObject *v = PyLong_FromVoidPtr(value); if (v == NULL) { return -1; } int rc = PyModule_AddObjectRef(mod, name, v); Py_DECREF(v); return rc; } #define INSERTINT(MOD, NAME, VAL) do { \ ...
<vulnerable_code>} while (0) static int inskey(PyObject *mod, char *name, HKEY key) { PyObject *v = PyLong_FromVoidPtr(key); if (v == NULL) { return -1; } int rc = PyModule_AddObjectRef(mod, name, v); Py_DECREF(v); return rc; } #define ADD_KEY(VAL) do { \<commit_title>[PATCH ...
<vulnerable_code>{ const wchar_t *mode = _Py_GetConfig()->check_hash_pycs_mode; PyObject *pyc_mode = PyUnicode_FromWideChar(mode, -1); if (pyc_mode == NULL) { return -1; } if (PyModule_AddObjectRef(module, "check_hash_based_pycs", pyc_mode) < 0) { Py_DECREF(pyc_mode); return ...
<vulnerable_code> class _ClassFinder(ast.NodeVisitor): def __init__(self, qualname): self.stack = [] self.qualname = qualname def visit_FunctionDef(self, node): self.stack.append(node.name) line_number = node.lineno # decrement by one since lines starts wit...
<vulnerable_code>nested_lambda = ( lambda right: [].map( lambda length: ()))<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-106706).<fixed_code> nested_lambda = ( lambda rig...
<vulnerable_code> self.assertSourceEqual(mod2.cls196.cls200, 198, 201) def test_class_inside_conditional(self): self.assertSourceEqual(mod2.cls238, 238, 240) self.assertSourceEqual(mod2.cls238.cls239, 239, 240) def test_multiple_children_classes(self): self.assertSourceEqual(mod...
<vulnerable_code> # If max_ev is 0, kqueue will ignore the timeout. For consistent # behavior with the other selector classes, we prevent that here # (using max). See https://bugs.python.org/issue29255 max_ev = max(len(self._fd_to_key), 1) ready = [] ...
<vulnerable_code> r, w, _ = self._select(self._readers, self._writers, [], timeout) except InterruptedError: return ready r = set(r) w = set(w) for fd in r | w: events = 0 if fd in r: events |= EVENT_READ if fd in...
<vulnerable_code> """ # support for a TextTestRunner using an old TestResult class if hasattr(self, "collectedDurations"): self.collectedDurations.append((test, elapsed)) def wasSuccessful(self): """Tells whether or not this result was a success."""<commit_title>[PATCH 01...
<vulnerable_code> @functools.cache def _is_case_sensitive(flavour): return flavour.normcase('Aa') == 'Aa' # # Globbing helpers # path. It's set when `__hash__()` is called for the first time. '_hash', ) _flavour = os.path def __new__(cls, *args, **kwargs): """Construct a PureP...
<vulnerable_code> def setUp(self): p = self.cls('a') self.flavour = p._flavour self.sep = self.flavour.sep self.altsep = self.flavour.altsep def test_constructor_common(self): P = self.cls p = self.cls('a') self.assertIs(type(p), expected) def test_d...
<vulnerable_code> def register(self, fileobj, events, data=None): key = super().register(fileobj, events, data) poller_events = 0 if events & EVENT_READ: poller_events |= self._EVENT_READ if events & EVENT_WRITE: poller_events |= self._EVENT_WRITE try:...
<vulnerable_code> return self def __exit__(self, *exc_details): received_exc = exc_details[0] is not None # We manipulate the exception state so it behaves as though # we were actually nesting multiple with statements frame_exc = sys.exc_info()[1] def _fix_exception_...
<vulnerable_code>class TestExitStack(TestBaseExitStack, unittest.TestCase): exit_stack = ExitStack callback_error_internal_frames = [ ('__exit__', 'raise exc_details[1]'), ('__exit__', 'if cb(*exc_details):'), ] <commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_des...
<vulnerable_code> ('__exit__', 'return self.run_coroutine(self.__aexit__(*exc_details))'), ('run_coroutine', 'raise exc'), ('run_coroutine', 'raise exc'), ('__aexit__', 'raise exc_details[1]'), ('__aexit__', 'cb_suppress = cb(*exc_details)'), ] <commit_title>[PATCH 016/395] Sm...
<vulnerable_code>#endif struct PyDecContextObject; typedef struct { PyTypeObject *PyDecContextManager_Type; PyObject *SignalTuple; /* External C-API functions */ binaryfunc _py_long_multiply; binaryfunc _py_long_floor_divide; #define DEC_ERR_OCCURRED (DEC_INVALID_SIGNALS<<1) #define DEC_ERRORS (...
<vulnerable_code> co.co_names, co.co_consts, linestarts, line_offset, co_positions=co.co_positions(), show_caches=show_caches) def _get_const_value(op, arg, co_consts): """Help...
<vulnerable_code>class TestOptimizerAPI(unittest.TestCase): def test_get_set_optimizer(self): self.assertEqual(_testinternalcapi.get_optimizer(), None) opt = _testinternalcapi.get_counter_optimizer() _testinternalcapi.set_optimizer(opt) self.assertEqual(_testinternalcapi.get_optimiz...
<vulnerable_code> @cpython_only @requires_specialization def test_loop_quicken(self): # Loop can trigger a quicken where the loop is located self.code_quicken(loop_test, 1) got = self.get_disassembly(loop_test, adaptive=True) self.do_disassembly_compare(got, dis_loop_test_quic...
<vulnerable_code> JUMPBY(1-oparg); #if ENABLE_SPECIALIZATION here[1].cache += (1 << OPTIMIZER_BITS_IN_COUNTER); if (here[1].cache > tstate->interp->optimizer_backedge_threshold) { OBJECT_STAT_INC(optimization_attempts); frame = _PyOptimizer_...
<vulnerable_code>_PyInterpreterFrame * _PyOptimizer_BackEdge(_PyInterpreterFrame *frame, _Py_CODEUNIT *src, _Py_CODEUNIT *dest, PyObject **stack_pointer) { PyCodeObject *code = (PyCodeObject *)frame->f_executable; assert(PyCode_Check(code)); PyInterpreterState *interp = _PyInterpreterState_GET();<commit_tit...
<vulnerable_code> } if (enabled) { PyObject *opt = PyUnstable_Optimizer_NewUOpOptimizer(); PyUnstable_SetOptimizer((_PyOptimizerObject *)opt); } } <commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR g...
<vulnerable_code> self.out.emit("") with self.out.block(f"case {thing.name}:"): instr.write(self.out, tier=TIER_TWO) self.out.emit("break;") # elif instr.kind != "op": ...
<vulnerable_code> __all__.extend(["hasarg", "hasconst", "hasname", "hasjump", "hasjrel", "hasjabs", "hasfree", "haslocal", "hasexc"]) hascompare = [opmap["COMPARE_OP"]] _nb_ops = [ ("NB_INPLACE_XOR", "^="), ] _intrinsic_1_descs = [ "INTRINSIC_1_INVALID", "INTRINSIC_PRINT", "INT...
<vulnerable_code>#include "compile.h" #include "opcode.h" #include "internal/pycore_code.h" /*[clinic input] module _opcode #endif } static PyMethodDef opcode_functions[] = { _OPCODE_STACK_EFFECT_METHODDEF _OPCODE_HAS_LOCAL_METHODDEF _OPCODE_HAS_EXC_METHODDEF _OPCODE_GET_SPECIALIZATION_STATS_METHODDE...
<vulnerable_code> inst(CALL_INTRINSIC_1, (value -- res)) { assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); DECREF_INPUTS(); ERROR_IF(res == NULL, error); } inst(CALL_INTRINSIC_2, (value2, value1 -- res))...
<vulnerable_code>/******** Unary functions ********/ static PyObject * no_intrinsic(PyThreadState* tstate, PyObject *unused) { _PyErr_SetString(tstate, PyExc_SystemError, "invalid intrinsic function"); return NULL; return _Py_make_typevar(v, NULL, NULL); } const instrinsic_func1 _PyIntrinsics_UnaryFunctio...
<vulnerable_code>#endif // !Py_INTERNAL_OPCODE_H """ intrinsic_header = f""" // Auto-generated by {SCRIPT_NAME} from {PYTHON_OPCODE} """.lstrip() intrinsic_footer = """ typedef PyObject *(*instrinsic_func1)(PyThreadState* tstate, PyObject *value); typedef PyObject *(*instrinsic_func2)(PyThreadState* tstate, PyObjec...
<vulnerable_code> PyObject **stack_pointer, PyObject *kwnames, int throwflag, binaryfunc binary_ops[], PyObject *args[] ) { iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { format_awaitable_error(tstate, Py_TYPE(iterable), oparg); } ...
<vulnerable_code> } while (0) #endif // GH-89279: Similar to above, force inlining by using a macro. #if defined(_MSC_VER) && SIZEOF_INT == 4 #define _Py_atomic_load_relaxed_int32(ATOMIC_VAL) (assert(sizeof((ATOMIC_VAL)->_value) == 4), *((volatile int*)&((ATOMIC_VAL)->_value))) #else #define _Py_atomic_load_relaxed...
<vulnerable_code><commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-106706).<fixed_code> #include "Python.h" #include "pycore_call.h" #include "pycore_ceval.h" #include "pycore_dict.h" #inclu...
<vulnerable_code> checksum_line = "#/*[{dsl_name} end generated code: {arguments}]*/" ParamGroup = Iterable["Parameter"] ParamTuple = tuple["Parameter", ...] def permute_left_option_groups( l: Sequence[ParamGroup] ) -> Iterator[ParamTuple]: """ Given [(1,), (2,), (3,)], should yield: def permut...
<vulnerable_code> """ # The C name to use for this variable. name: str | None = None # The Python name to use for this variable. py_name: str | None = None # The C type to use for this variable. # 'type' should be a Python string specifying the type, e.g. "int". if self.length: ...
<vulnerable_code>import parser from parser import StackEffect HERE = os.path.dirname(__file__) ROOT = os.path.join(HERE, "../..") THIS = os.path.relpath(__file__, ROOT).replace(os.path.sep, posixpath.sep) self.out.emit("") def from_source_files(self) -> str: paths = f"\n{self.out.comment} ".join...
<vulnerable_code> if not self.indents: fail('IndentStack expected indents, but none are defined.') def measure(self, line): """ Returns the length of the line's margin. """ return self.indents[-1] return len(line) - len(stripped) def infer(self, l...
<vulnerable_code> return address def _pre_parse_validation(email_header_fields): accepted_values = [] for v in email_header_fields: s = v.replace('\\(', '').replace('\\)', '') if s.count('(') != s.count(')'): v = "('', '')" accepted_values.append(v) return accepted_...
<vulnerable_code> [('Al Person', 'aperson@dom.ain'), ('Bud Person', 'bperson@dom.ain')]) def test_getaddresses_parsing_errors(self): """Test for parsing errors from CVE-2023-27043""" eq = self.assertEqual eq(utils.getaddresses(['alice@example.org(<bob@example.com>']), ...
<vulnerable_code> } char *buff = PyMem_Malloc(doc_size); char *w = buff; while (p < pend) {<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-106706).<fixed_code> } c...
<vulnerable_code> Nested docstring here, goeth. """) def test_directive(self): c = FakeClinic() parser = DSLParser(c)<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR ...
<vulnerable_code> if (res < 0) { return -1; } res = PyModule_AddObject( m, "_test_structmembersType_OldAPI", (PyObject *)&test_structmembersType_OldAPI);<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-...
<vulnerable_code> PyObject *s, *ignored_value; while (PyDict_Next(interned, &pos, &s, &ignored_value)) { assert(PyUnicode_IS_READY(s)); switch (PyUnicode_CHECK_INTERNED(s)) { case SSTATE_INTERNED_IMMORTAL: // Skip the Immortal Instance check and restore #endif brea...
<vulnerable_code> /* Set Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors global configuration variables. */ if (_Py_SetFileSystemEncoding(fs_codec->encoding, fs_codec->errors) < 0) { PyErr_NoMemory(); return -1; } return 0; }<com...
<vulnerable_code> "PyDict_DelItem", "PyDict_DelItemString", "PyDict_GetItem", "PyDict_GetItemString", "PyDict_GetItemWithError", "PyDict_Items", "PyDict_Keys",<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (is...
<vulnerable_code>} static PyMethodDef TestMethods[] = { {"set_errno", set_errno, METH_VARARGS}, {"test_config", test_config, METH_NOARGS}, {"function_set_kw_defaults", function_set_kw_defaults, METH_VARARGS, NULL}, {"check_pyimport_ad...
<vulnerable_code> /* Ignore any exception raised by the lookup */ _PyErr_SetRaisedException(tstate, exc); assert(ix >= 0 || value == NULL); return value; } Py_ssize_t ix = _Py_dict_lookup(mp, key, hash, &value); assert(ix >= 0 || value == NULL); return value; } /* Variant of PyDict_GetIt...
<vulnerable_code>EXPORT_FUNC(PyDict_DelItem) EXPORT_FUNC(PyDict_DelItemString) EXPORT_FUNC(PyDict_GetItem) EXPORT_FUNC(PyDict_GetItemString) EXPORT_FUNC(PyDict_GetItemWithError) EXPORT_FUNC(PyDict_Items) EXPORT_FUNC(PyDict_Keys)<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>The...
<vulnerable_code> class B: y = 0 __slots__ = ('z',) error_msg = "'A' object has no attribute 'x'" with self.assertRaisesRegex(AttributeError, error_msg): B().x with self.assertRaisesRegex(AttributeError, error_msg): del B().x with s...
<vulnerable_code> >>> a.x1 = 1 Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: 'defaultdict2' object has no attribute 'x1' >>> """<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issu...
<vulnerable_code> } if (dictptr == NULL) { if (descr == NULL) { PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%U'", tp->tp_name, name); } else { PyErr_Format...
<vulnerable_code>static PyObject * Test_meth_coexist_impl(TestObj *self) /*[clinic end generated code: output=808a293d0cd27439 input=2a1d75b5e6fec6dd]*/<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716...
<vulnerable_code> out = self.expect_failure(raw) self.assertEqual(out, msg) class ClinicGroupPermuterTest(TestCase): def _test(self, l, m, r, output):<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) ...
<vulnerable_code> def clear(self): for ta in self._array: ta._text.clear() def dump(self): texts = [ta.output() for ta in self._array] command: str, *args ) -> None: if command == 'new': self.clinic.add_destination(name, *args) ...
<vulnerable_code><commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-106706).<fixed_code> #!/usr/bin/env python3 """ Check the output of running Sphinx in nit-picky mode (missing references). "...
<vulnerable_code>#!/usr/bin/env python3 """ Touch files that must pass Sphinx nit-picky mode so they are rebuilt and we can catch regressions. """ import argparse import csv import sys from pathlib import Path wrong_directory_msg = "Must run this script from the repo root" assert Path("Doc").exists() and Path("Doc").i...
<vulnerable_code>#!/usr/bin/env python3 """ Convert Sphinx warning messages to GitHub Actions. Converts lines like: .../Doc/library/cgi.rst:98: WARNING: reference target not found to: ::warning file=.../Doc/library/cgi.rst,line=98::reference target not found Non-matching lines are echoed unchanged. see: htt...
<vulnerable_code> out = self.expect_failure(raw) self.assertEqual(out, msg) def test_unknown_destination_command(self): out = self.expect_failure(""" /*[clinic input]<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found...
<vulnerable_code> e.g. o[-1] is an element immediately preceding o[0]. """ def __init__(self): self._start = 0 self._array = [] self._constructor = _text_accumulator def __getitem__(self, i): i -= self._start if i < 0: self._start += i sel...
<vulnerable_code> @support.requires_subprocess() def test_no_FatalError_infinite_loop(self): run_result, _cmd_line = run_python_until_end( '-c', 'import _testcapi; _testcapi.crash_no_current_thread()', ) _rc, out, err = run_result self.assertEqual(out, b'') # ...
<vulnerable_code> from test import support from test.support import import_helper _interpreters = import_helper.import_module('_xxsubinterpreters') _channels = import_helper.import_module('_xxinterpchannels') from test.support import interpreters # test_xxsubinterpreters covers the remaining Interpreter.run() behav...
<vulnerable_code> tok->implicit_newline = 0; tok->tok_mode_stack[0] = (tokenizer_mode){.kind =TOK_REGULAR_MODE, .f_string_quote='\0', .f_string_quote_size = 0, .f_string_debug=0}; tok->tok_mode_stack_index = 0; tok->tok_report_warnings = 1; #ifdef Py_DEBUG tok->debug = _Py_GetConfig()->parser_debug; ...
<vulnerable_code> _locale.setlocale(_locale.LC_TIME, self.locale) def __exit__(self, *args): if self.oldlocale is None: return _locale.setlocale(_locale.LC_TIME, self.oldlocale) return seconds def main(args): import argparse parser = argparse.ArgumentParser() ...
<vulnerable_code> from test import support from test.support.script_helper import assert_python_ok, assert_python_failure import time import locale import sys import datetime import os # From https://en.wikipedia.org/wiki/Leap_year_starting_on_Saturday result_0_02_text = """\ # verify it "acts like a seque...
<vulnerable_code> #include "Python.h" #include "pycore_import.h" // _PyImport_GetModuleAttrString() #include "structmember.h" // PyMemberDef #include "expat.h" #include "pyexpat.h"<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-1...
<vulnerable_code> #include "Python.h" #include "pycore_hashtable.h" #include "hashlib.h" #include "pycore_strhex.h" // _Py_strhex() /* EVP is the preferred interface to hashing in OpenSSL */ #include <openssl/evp.h><commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These re...
<vulnerable_code> See the source code for LLVMFuzzerTestOneInput for details. */ #include <Python.h> #include <stdlib.h> #include <inttypes.h> <commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issu...
<vulnerable_code> #include "Python.h" #include "pycore_import.h" // _PyImport_SetModule() #include <ctype.h> #include "structmember.h" // PyMemberDef<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in...
<vulnerable_code> #include "Python.h" #include "pycore_hashtable.h" #define HASHTABLE_MIN_SIZE 16 #define HASHTABLE_HIGH 0.50<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-106706).<fixed_...
<vulnerable_code> All the utility functions (_Py_Hash*()) return "-1" to signify an error. */ #include "Python.h" #ifdef __APPLE__ # include <libkern/OSByteOrder.h><commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and...
<vulnerable_code>#include "pycore_bytesobject.h" // _PyBytesWriter #include "pycore_ceval.h" // _Py_EnterRecursiveCall() #include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_runtime.h" // _Py_ID() #include "structmember.h" ...
<vulnerable_code>static char * readline_until_enter_or_signal(const char *prompt, int *signal) { char * not_done_reading = ""; fd_set selectset; <commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-10671...
<vulnerable_code>#endif /* MS_WINDOWS */ PyThreadState* _PyOS_ReadlineTState = NULL; static PyThread_type_lock _PyOS_ReadlineLock = NULL; <commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-...
<vulnerable_code> raise SMTPNotSupportedError( 'SMTPUTF8 not supported by server') optionlist = ' ' + ' '.join(options) self.putcmd("mail", "FROM:%s%s" % (quoteaddr(sender), optionlist)) return self.getreply() def rcpt(self, recip, options=()):...
<vulnerable_code> def __init__(self, extra_features, *args, **kw): self._extrafeatures = ''.join( [ "250-{0}\r\n".format(x) for x in extra_features ]) super(SimSMTPChannel, self).__init__(*args, **kw) # AUTH related stuff. It would be nice if support for this were in smtpd. ...
<vulnerable_code>#include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_object.h" // _PyType_GetSubclasses() #include "pycore_runtime.h" // _Py_ID() #include "pycore_typeobject.h" // _PyType_GetMRO() #include "pycore_weakref.h" // _PyWeakref_GET_REF() #include "clinic/_abc.c.h"...
<vulnerable_code>#include "pycore_object.h" // _PyNone_Type #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_runtime.h" // _Py_ID() #include "structmember.h" // PyMemberDef #include <stdlib.h> // strtol()<commit_title>[PATCH 016/395] Small fixes to code gene...
<vulnerable_code>#include "pycore_interp.h" // PyInterpreterState.co_extra_freefuncs #include "pycore_opcode.h" // _PyOpcode_Deopt #include "pycore_pystate.h" // _PyInterpreterState_GET() #include "pycore_tuple.h" // _PyTuple_ITEMS() #include "clinic/codeobject.c.h" <commit_title>[PATCH 016/...
<vulnerable_code>#include "pycore_object.h" // _PyObject_GC_TRACK() #include "pycore_pyerrors.h" // _PyErr_GetRaisedException() #include "pycore_pystate.h" // _PyThreadState_GET() #include "stringlib/eq.h" // unicode_eq() #include <stdbool.h><commit_title>[PATCH 016/395] Small fixes to code g...
<vulnerable_code>#include "Python.h" #include "pycore_modsupport.h" // _PyArg_NoKwnames() #include "pycore_object.h" // _PyObject_GC_UNTRACK() #include <stddef.h> // offsetof() /* Object used as dummy key to fill deleted entries */<commit_title>[PATCH 016/395] Small fixes to code generator (#10...
<vulnerable_code>/* AST Optimizer */ #include "Python.h" #include "pycore_ast.h" // _PyAST_GetDocString() #include "pycore_long.h" // _PyLong #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_format.h" // F_LJUST typedef struct {<commit_title>[PATCH 016/395] Small f...
<vulnerable_code>#include "pycore_abstract.h" // _PyIndex_Check() #include "pycore_ceval.h" // _PyEval_SignalAsyncExc() #include "pycore_code.h" #include "pycore_function.h" #include "pycore_intrinsics.h" #include "pycore_long.h" // _PyLong_GetZero() #include "pycore_instruments.h" #include "pycor...
<vulnerable_code>#include "pycore_call.h" // _PyObject_CallNoArgs() #include "pycore_ceval.h" // _PyEval_SignalAsyncExc() #include "pycore_code.h" #include "pycore_function.h" #include "pycore_intrinsics.h" #include "pycore_long.h" // _PyLong_GetZero() #include "pycore_instruments.h" #include ...