text
stringlengths
79
3.72M
<vulnerable_code> def setUp(self): self._backup_platform = sys.platform self._backup_get_config_var = sysconfig.get_config_var class CompilerWrapper(UnixCCompiler): def rpath_foo(self): return self.runtime_library_dir_option('/foo') def tearDown(self): ...
<vulnerable_code> os.uname = self.uname else: del os.uname sysconfig._config_vars = copy(self._config_vars) super(UtilTestCase, self).tearDown() def _set_uname(self, uname):<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_descr...
<vulnerable_code>sys.argv[1:] = {args} runpy.run_module("pip", run_name="__main__", alter_sys=True) """ return subprocess.run([sys.executable, "-c", code], check=True).returncode def version():<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code> sys.ar...
<vulnerable_code>_CONFIG_VARS = None _USER_BASE = None def _safe_realpath(path): try: def _parse_makefile(filename, vars=None): """Parse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used inste...
<vulnerable_code> missing. """ from distutils import ccompiler, sysconfig, spawn, errors compiler = ccompiler.new_compiler() sysconfig.customize_compiler(compiler)<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code> missing. """ ...
<vulnerable_code> class TestCParser(TempdirManager, unittest.TestCase): def setUp(self): cmd = support.missing_compiler_executable() if cmd is not None: self.skipTest("The %r command is not found" % cmd) def tearDown(self): super(TestCParser, self).tearDown() def build_...
<vulnerable_code> OPENSSL_RECENT_VERSIONS = [ "1.1.1k", "3.0.0-alpha14" ] LIBRESSL_OLD_VERSIONS = [<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code> OPENSSL_RECENT_VERSIONS = [ "1.1.1k", "3.0.0-alpha15" ] LIBRESSL_OLD_VERSIONS = [
<vulnerable_code>EXPORT_DATA(PyODictKeys_Type) EXPORT_DATA(PyODictValues_Type) EXPORT_DATA(PyOS_InputHook) EXPORT_DATA(PyOS_ReadlineFunctionPointer) EXPORT_DATA(PyProperty_Type) EXPORT_DATA(PyRange_Type) EXPORT_DATA(PyRangeIter_Type)<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<comm...
<vulnerable_code> exitcode, stdout, stderr = assert_python_failure(script_name) text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read() # Confirm that the caret is located under the '=' sign self.assertIn("\n 1 + 1 = 2\n ^\n", text) def test_syntaxerro...
<vulnerable_code>import pickle import weakref import errno from test.support import (captured_stderr, check_impl_detail, cpython_only, gc_collect, check('from __future__ import doesnt_exist', 1, 1) check('from __future__ import braces', 1, 1) check('x=1\nfrom __future_...
<vulnerable_code> self._check_error( "print(end1 + end2 = ' ')", 'expression cannot contain assignment, perhaps you meant "=="?', offset=19 ) def test_curly_brace_after_primary_raises_immediately(self):<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning i...
<vulnerable_code> if (lenargs == 2) { info = PyTuple_GET_ITEM(args, 1); info = PySequence_Tuple(info); if (!info) return -1; if (PyTuple_GET_SIZE(info) != 4) { /* not a very good error message, but it's what Python 2.4 gives */ PyErr_SetString(PyEx...
<vulnerable_code>#define _tmp_150_type 1363 #define _tmp_151_type 1364 #define _tmp_152_type 1365 #define _loop0_153_type 1366 #define _loop1_154_type 1367 #define _loop0_155_type 1368 #define _loop1_156_type 1369 #define _tmp_157_type 1370 #define _tmp_158_type 1371 #define _tmp_159_type 1372 #define _loop0_161_type 1...
<vulnerable_code> int error_lineno = p->tok->parenlinenostack[p->tok->level-1]; int error_col = p->tok->parencolstack[p->tok->level-1]; RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, error_lineno, error_col, "'%c' was never closed...
<vulnerable_code> int u_firstlineno; /* the first lineno of the block */ int u_lineno; /* the lineno for the current stmt */ int u_col_offset; /* the offset of the current stmt */ }; /* This struct captures the global state of a compilation. u->u_firstlineno = lineno; u->u_lineno = 0; ...
<vulnerable_code> If the exception is not a SyntaxError, also sets additional attributes to make printing of exceptions believe it is a syntax error. */ void PyErr_SyntaxLocationObject(PyObject *filename, int lineno, int col_offset) { PyObject *exc, *v, *tb, *tmp; _Py_IDENTIFIER(filename); _Py_IDENTIF...
<vulnerable_code> static int parse_syntax_error(PyObject *err, PyObject **message, PyObject **filename, Py_ssize_t *lineno, Py_ssize_t *offset, PyObject **text) { Py_ssize_t hold; PyObject *v; _Py_IDENTIFIER(filename); _Py_IDENTIFIER(lineno); _Py_IDENTIFIER(offset); _Py_IDENTI...
<vulnerable_code> static PySTEntryObject * ste_new(struct symtable *st, identifier name, _Py_block_ty block, void *key, int lineno, int col_offset) { PySTEntryObject *ste = NULL; PyObject *k = NULL; ste->ste_opt_col_offset = 0; ste->ste_lineno = lineno; ste->ste_col_offset = col_offset; ...
<vulnerable_code>/*[clinic input] _ssl.RAND_status Returns 1 if the OpenSSL PRNG has been seeded with enough data and 0 if not. It is necessary to seed the PRNG with RAND_add() on some platforms before using the ssl() function. static PyObject * _ssl_RAND_status_impl(PyObject *module) /*[clinic end generated code: o...
<vulnerable_code> # becomes # ///C:/foo/bar/spam.foo import urllib.parse if not ':' in p: # No drive specifier, just convert slashes and quote the name if p[:2] == '\\\\': p = '\\\\' + p components = p.split('\\') return urllib.parse.quote('/'.join(components...
<vulnerable_code> "url2pathname() failed; %s != %s" % (expect, result)) @unittest.skipUnless(sys.platform == 'win32', 'test specific to the urllib.url2path function.') def test_ntpath(self):<commit_title>[PATCH 003/413] bpo-43651: Fix En...
<vulnerable_code>startfile = support.get_attribute(os, 'startfile') class TestCase(unittest.TestCase): def test_nonexisting(self): self.assertRaises(OSError, startfile, "nonexisting.vbs") @unittest.skipIf(platform.win32_is_iot(), "starting files is not supported on Windows IoT Core or nanoserver") ...
<vulnerable_code>os.startfile filepath: path_t operation: Py_UNICODE = NULL Start a file with its associated application. When another "operation" is given, it specifies what should be done with the file. A typical operation is "print". startfile returns as soon as the associated application is launched. Th...
<vulnerable_code> s.connect((HOST, server.port)) try: s.write(b'data') s.read(4) except ssl.SSLError as e: if support.verbose: sys.stdout.write("\nSSLError is %r\n" % e) if support.verbose: ...
<vulnerable_code>import posixpath import re import sys from _collections_abc import Sequence from errno import EINVAL, ENOENT, ENOTDIR, EBADF, ELOOP from operator import attrgetter """ self._accessor.symlink(target, self, target_is_directory) def link_to(self, target): """ Make the ...
<vulnerable_code> # linking to another path. q = P / 'dirA' / 'fileAA' try: p.link_to(q) except PermissionError as e: self.skipTest('os.link(): %s' % e) self.assertEqual(q.stat().st_size, size) self.assertEqual(os.stat(r).st_size, size) self...
<vulnerable_code> self._write_large_bytes(BYTEARRAY8 + pack("<Q", n), obj) else: self.write(BYTEARRAY8 + pack("<Q", n) + obj) dispatch[bytearray] = save_bytearray if _HAVE_PICKLE_BUFFER:<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_desc...
<vulnerable_code> self.assertNotIn(b'bytearray', p) self.assertTrue(opcode_in_pickle(pickle.BYTEARRAY8, p)) def test_ints(self): for proto in protocols: n = sys.maxsize<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commi...
<vulnerable_code>import re import sys import unittest from test import support from test.support import import_helper from contextlib import contextmanager self.assertIs(spec, None) def test_find_module_missing(self): loader = self.machinery.WindowsRegistryFinder.find_module('spam') self.as...
<vulnerable_code> int fd = PyLong_AsLong(path_or_fd); PyErr_Clear(); if (fd >= 0) { HANDLE handle; _Py_BEGIN_SUPPRESS_IPH handle = (HANDLE)_get_osfhandle(fd); _Py_END_SUPPRESS_IPH if (handle == INVALID_HANDLE_VALUE) return '\0'; return _get_console_...
<vulnerable_code> */ if (fileno != -1 && fileno != 0) { /* Ensure that fileno is within the CRT's valid range */ _Py_BEGIN_SUPPRESS_IPH fh = (HANDLE)_get_osfhandle(fileno); _Py_END_SUPPRESS_IPH if (fh==(HANDLE)-1) { PyErr_SetFromErrno(PyExc_OSError); ...
<vulnerable_code> attr.bInheritHandle = FALSE; Py_BEGIN_ALLOW_THREADS _Py_BEGIN_SUPPRESS_IPH ok = CreatePipe(&read, &write, &attr, 0); if (ok) { fds[0] = _open_osfhandle((intptr_t)read, _O_RDONLY); fds[1] = _open_osfhandle((intptr_t)write, _O_WRONLY); if (fds[0] == -1 || fds[...
<vulnerable_code>#include <fcntl.h> /* The full definition is in iomodule. We reproduce enough here to get the handle, which is all we want. */ typedef struct { PyObject_HEAD HANDLE handle; } winconsoleio; prec->Event.KeyEvent.uChar.UnicodeChar = *p; } HANDLE hInput = ((winconsoleio*)file)...
<vulnerable_code>msvcrt_open_osfhandle_impl(PyObject *module, void *handle, int flags) /*[clinic end generated code: output=b2fb97c4b515e4e6 input=d5db190a307cf4bb]*/ { int fd; if (PySys_Audit("msvcrt.open_osfhandle", "Ki", handle, flags) < 0) { return -1; } _Py_BEGIN_SUPPRESS_IPH fd = _op...
<vulnerable_code> if (!Py_LegacyWindowsStdioFlag && sys_stdin == stdin) { HANDLE hStdIn, hStdErr; _Py_BEGIN_SUPPRESS_IPH hStdIn = (HANDLE)_get_osfhandle(fileno(sys_stdin)); hStdErr = (HANDLE)_get_osfhandle(fileno(stderr)); _Py_END_SUPPRESS_IPH if (_get_console_type(h...
<vulnerable_code> HANDLE h; int type; _Py_BEGIN_SUPPRESS_IPH h = (HANDLE)_get_osfhandle(fd); _Py_END_SUPPRESS_IPH if (h == INVALID_HANDLE_VALUE) { /* errno is already set by _get_osfhandle, but we also set HANDLE handle; DWORD flags; _Py_BEGIN_SUPPRESS_IPH handle = (HAN...
<vulnerable_code> simple_member_dict = simple_enum[name].__dict__ simple_member_keys = list(simple_member_dict.keys()) for key in set(checked_member_keys + simple_member_keys): if key in ('__module__', '__objclass__'): # keys kno...
<vulnerable_code> from _ssl import enum_certificates, enum_crls from socket import socket, SOCK_STREAM, create_connection from socket import SOL_SOCKET, SO_TYPE import socket as _socket import base64 # for DER-to-PEM translation import errno d = pem_cert_string.strip()[len(PEM_HEADER):-len(PEM_FOOTER)] ...
<vulnerable_code> # independent test method _test_get_server_certificate_fail(self, *self.server_addr) def test_ciphers(self): with test_wrap_socket(socket.socket(socket.AF_INET), cert_reqs=ssl.CERT_NONE, ciphers="ALL") as s:<commit_title>[PATCH 003/413] bpo-4365...
<vulnerable_code> _test_get_server_certificate_fail(self, *self.server_addr) def test_get_server_certificate_timeout(self): with self.assertRaises(socket.timeout): ssl.get_server_certificate(self.server_addr, ca_certs=SIGNING_CA, timeout=0.0001) ...
<vulnerable_code> sys.stdout.write(" client cert is " + pprint.pformat(cert) + "\n") cert_binary = self.sslconn.getpeercert(True) if support.verbose and self.server.chatty: sys.stdout.write(" cert binary is " + str(len(cert_binary)) ...
<vulnerable_code> from sysconfig import _fix_pcbuild warnings.warn( 'the distutils.sysconfig module is deprecated, use sysconfig instead', DeprecationWarning, stacklevel=2 )<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code> from sysconf...
<vulnerable_code> with warnings.catch_warnings(): # bpo-41282 (PEP 632) deprecated distutils but setup.py still uses it warnings.filterwarnings("ignore", "The distutils package is deprecated", DeprecationWarning) from distutils import log from distutils.command.build_ext imp...
<vulnerable_code> server_hostname=hostname) as s: s.connect((HOST, server.port)) s.write(b'PHA') with self.assertRaisesRegex( ssl.SSLError, 'tlsv13 alert certificate required' ...
<vulnerable_code><commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code> import collections # from jaraco.collections 3.3 class FreezableDefaultDict(collections.defaultdict): """ Often it is desirable to prevent the mutation of a default dict afte...
<vulnerable_code><commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code> import types import functools # from jaraco.functools 3.3 def method_cache(method, cache_wrapper=None): """ Wrap lru_cache to support storing the cache data in the object instanc...
<vulnerable_code>import pathlib import zipfile import operator import warnings import functools import itertools import posixpath import collections from ._itertools import unique_everseen from configparser import ConfigParser from contextlib import suppress from importlib import import_module from importlib.abc impo...
<vulnerable_code> Version: 1.0.0 Requires-Dist: wheel >= 1.0 Requires-Dist: pytest; extra == 'test' """, "RECORD": "mod.py,sha256=abc,20\n", "entry_points.txt": """ Version: 1.0.0 Classifier: Intended ...
<vulnerable_code>import textwrap import unittest import warnings from . import fixtures from importlib.metadata import ( dist_info_path = self.site_dir / 'distinfo_pkg-1.0.0.dist-info' dist = Distribution.at(str(dist_info_path)) assert dist.version == '1.0.0'<commit_title>[PATCH 003/413] bpo-43...
<vulnerable_code> __all__ = ["version", "bootstrap"] _PACKAGE_NAMES = ('setuptools', 'pip') _SETUPTOOLS_VERSION = "52.0.0" _PIP_VERSION = "21.0.1" _PROJECTS = [ ("setuptools", _SETUPTOOLS_VERSION, "py3"), ("pip", _PIP_VERSION, "py3"),<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25...
<vulnerable_code> ... async def g2(arg: {ann}) -> None: ... var: {ann} var2: {ann} = None """ ) self.assertAnnotationEqual("('inf', 1e1000, 'infxxx', 1e1000j)", expected=f"('inf', {inf}, 'infxxx', {infj})") self.assertAnnotationEqual("(1e1000, ...
<vulnerable_code>static int check_annotation(struct compiler *c, stmt_ty s) { /* Annotations are only evaluated in a module or class. */ if (c->u->u_scope_type == COMPILER_SCOPE_MODULE || c->u->u_scope_type == COMPILER_SCOPE_CLASS) {<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io...
<vulnerable_code>from tkinter import Toplevel, Listbox, StringVar, TclError from tkinter.ttk import Frame, Button, Checkbutton, Entry, Label, Scrollbar from tkinter import messagebox import string import sys self.resizable(height=False, width=False) self.title(title) self.transient(parent) ...
<vulnerable_code>from tkinter.ttk import Frame, Button, Entry, Label, Checkbutton from tkinter import filedialog from tkinter.font import Font class Query(Toplevel): """Base class for getting verified answer from a user. if not _utest: # Otherwise fail when directly run unittest. self.grab_set...
<vulnerable_code> from tkinter import Toplevel from tkinter.ttk import Frame, Entry, Label, Button, Checkbutton, Radiobutton class SearchDialogBase: top.protocol("WM_DELETE_WINDOW", self.close) top.wm_title(self.title) top.wm_iconname(self.icon) self.top = top self.frame = Fram...
<vulnerable_code>) from tkinter.dialog import Dialog from tkinter import commondialog dialogstates = {} self.top = Toplevel(master) self.top.title(title) self.top.iconname(title) self.botframe = Frame(self.top) self.botframe.pack(side=BOTTOM, fill=X)<commit_title>[PATCH 003/41...
<vulnerable_code> if title: self.root.title(title) self.root.iconname(title) self.message = Message(self.root, text=text, aspect=400) self.message.pack(expand=1, fill=BOTH) self.frame = Frame(self.root) if title: self.title(title) self....
<vulnerable_code> >>> screen.textinput("NIM", "Name of first player:") """ return simpledialog.askstring(title, prompt) def numinput(self, title, prompt, default=None, minval=None, maxval=None): """Pop up a dialog window for input of a number. """ return simpledialo...
<vulnerable_code> # XXX (ncoghlan): duplicating the scaling factor here is a little # ugly. Perhaps it should be exposed somewhere... fail_depth = sys.getrecursionlimit() * 3 success_depth = int(fail_depth * 0.75) def check_limit(prefix, repeated): expect_ok = prefix ...
<vulnerable_code> */ #include "Python.h" #include "pycore_ast.h" // asdl_stmt_seq #include <assert.h> static int validate_stmts(asdl_stmt_seq *); static int validate_exprs(asdl_expr_seq*, expr_context_ty, int); static int _validate_nonempty_seq(asdl_seq *, const char *, const char *); static int validate_st...
<vulnerable_code>#include "Python.h" #include "pycore_ast.h" // _PyAST_GetDocString() #include "pycore_compile.h" // _PyASTOptimizeState static int static int astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) { switch (node_->kind) { case BoolOp_kind: CALL_SEQ(astf...
<vulnerable_code> the result of `get_event_loop_policy().get_event_loop()` call. """ # NOTE: this function is implemented in C (see _asynciomodule.c) current_loop = _get_running_loop() if current_loop is not None: return current_loop return get_event_loop_policy().get_event_loop() _py__...
<vulnerable_code> the default event loop. """ if loop is None: self._loop = events.get_event_loop() else: self._loop = loop self._callbacks = [] assert isinstance(future, concurrent.futures.Future), \ f'concurrent.futures.Future is expected, got...
<vulnerable_code> def __init__(self, loop=None): if loop is None: self._loop = events.get_event_loop() else: self._loop = loop self._paused = False def __del__(self): # Prevent reports about unhandled exceptions. # Better than self._closed._log_tra...
<vulnerable_code> from .queues import Queue # Import here to avoid circular import problem. done = Queue() loop = events.get_event_loop() todo = {ensure_future(f, loop=loop) for f in set(fs)} timeout_handle = None If the argument is a Future, it is returned directly. """ if coroutines...
<vulnerable_code> asyncio.set_event_loop_policy(Policy()) loop = asyncio.new_event_loop() with self.assertRaises(TestError): asyncio.get_event_loop() asyncio.set_event_loop(None) with self.assertRaises(TestError): asyncio.get_ev...
<vulnerable_code> f.cancel() self.assertTrue(f.cancelled()) def test_init_constructor_default_loop(self): asyncio.set_event_loop(self.loop) f = self._new_future() self.assertIs(f._loop, self.loop) self.assertIs(f.get_loop(), self.loop) f2 = asyncio.wrap_futur...
<vulnerable_code> queue._get_loop() return queue q = self.loop.run_until_complete(create_queue()) self.loop.run_until_complete( asyncio.gather(producer(q, producer_num_items), consumer(q, producer_num_items)), ) def test_ca...
<vulnerable_code> gc.collect() super().tearDown() @mock.patch('asyncio.streams.events') def test_ctor_global_loop(self, m_events): stream = asyncio.StreamReader() self.assertIs(stream._loop, m_events.get_event_loop.return_value) def _basetest_open_connection(self, open_conne...
<vulnerable_code> loop.close() def test_ensure_future_coroutine(self): with self.assertWarns(DeprecationWarning): @asyncio.coroutine def notmuch(): return 'ok' t = asyncio.ensure_future(notmuch(), loop=self.loop) self.loop.run_until_complete(t)...
<vulnerable_code> static PyObject * get_event_loop(void) { PyObject *loop; PyObject *policy; return loop; } policy = PyObject_CallNoArgs(asyncio_get_event_loop_policy); if (policy == NULL) { return NULL; fut->fut_blocking = 0; if (loop == Py_None) { loop = get_even...
<vulnerable_code>2.5 Exceptions ---------- 'quantiles', 'stdev', 'variance', ] import math from bisect import bisect_left, bisect_right from math import hypot, sqrt, fabs, exp, erf, tau, log, fsum from operator import itemgetter from collections import Counter # === Exceptions === return math....
<vulnerable_code> quantiles([10, None, 30], n=4) # data is non-numeric class TestNormalDist: # General note on precision: The pdf(), cdf(), and overlap() methods<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code> quantiles...
<vulnerable_code> a corresponding TurtleScreenBase class has to be implemented. """ @staticmethod def _blankimage(): """return a blank image object """ img = TK.PhotoImage(width=1, height=1) img.blank() return img @staticmethod def _image(filename): ...
<vulnerable_code> CO_FUTURE_GENERATOR_STOP) annotations = _Feature((3, 7, 0, "beta", 1), (3, 10, 0, "alpha", 0), CO_FUTURE_ANNOTATIONS)<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code...
<vulnerable_code> msg = _get_invalid_paths_message(raw_tzpath) warnings.warn( "Invalid paths specified in PYTHONTZPATH environment variable." + msg, InvalidTZPathWarning, )<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commi...
<vulnerable_code> 'Field', 'FrozenInstanceError', 'InitVar', 'MISSING', # Helper functions. # +-------+-------+-------+ # | True | add | | <- the default # +=======+=======+=======+ # __match_args__ is a tuple of __init__ parameter names; non-init fields ...
<vulnerable_code> f"default=1,default_factory={MISSING!r}," \ "init=True,repr=False,hash=None," \ "compare=True,metadata=mappingproxy({})," \ "_field_type=None)" self.assertEqual(repr_output, expected_out...
<vulnerable_code> source_address=None): """Initialize a new instance. If specified, `host' is the name of the remote host to which to connect. If specified, `port' specifies the port to which to connect. By default, smtplib.SMTP_PORT is used. If a host is specified the...
<vulnerable_code> from urllib.error import HTTPError except ImportError: from urllib2 import urlopen, HTTPError import shutil import string import subprocess @property def short_version(self): """Short version for OpenSSL download URL""" short_version = self.version.rstrip(string.ascii_le...
<vulnerable_code> ctypes = None ssl = import_helper.import_module("ssl") from ssl import TLSVersion, _TLSContentType, _TLSMessageType, _TLSAlertType return context.wrap_socket(sock, **kwargs) def testing_context(server_cert=SIGNED_CERTFILE): """Create context client_context, server_context, hostnam...
<vulnerable_code> return retval; } /*[clinic input] _ssl._test_decode_cert path: object(converter="PyUnicode_FSConverter") return result; } static PyObject * cipher_to_tuple(const SSL_CIPHER *cipher) { _SSL__SSLSOCKET_COMPRESSION_METHODDEF _SSL__SSLSOCKET_SHUTDOWN_METHODDEF _SSL__SSLSOCKET_VERI...
<vulnerable_code><commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code> #include "Python.h" #include "../_ssl.h" #include "openssl/err.h" #include "openssl/bio.h" #include "openssl/pem.h" #include "openssl/x509.h" /*[clinic input] module _ssl class _ssl.Cert...
<vulnerable_code><commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code> #include "Python.h" #include "../_ssl.h" #include "openssl/bio.h" /* BIO_s_mem() to PyBytes */ static PyObject * _PySSL_BytesFromBIO(_sslmodulestate *state, BIO *bio) { long size; ...
<vulnerable_code> Extension( '_ssl', ['_ssl.c'], depends=['socketmodule.h', '_ssl/debughelpers.c', '_ssl.h'], **openssl_extension_kwargs ) )<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<co...
<vulnerable_code> extra_linker_args.append(f"-Wl,--exclude-libs,lib{lib}.a") openssl_extension_kwargs["extra_link_args"] = extra_linker_args # don't link OpenSSL shared libraries. openssl_extension_kwargs["libraries"] = [] self.add( Extension(<comm...
<vulnerable_code> self.assertEqual(C.__match_args__, ('z',)) class TestKwArgs(unittest.TestCase): def test_no_classvar_kwarg(self): msg = 'field a is a ClassVar but specifies kw_only' with self.assertRaisesRegex(TypeError, msg): b = B(1, c=2, b=3, d=4) self.assertEqual(asdic...
<vulnerable_code> {'other': MySet[T], 'return': MySet[T]} ) def test_get_type_hints_classes(self): class Foo: y = str x: y # This previously raised an error under PEP 563. self.assertEqual(get_type_hints(Foo), {'x': str}) <commit_title>[PATCH 003/4...
<vulnerable_code> - If no dict arguments are passed, an attempt is made to use the globals from obj (or the respective module's globals for classes), and these are also used as the locals. If the object does not appear to have globals, an empty dictionary is used. - If one dict argument is pa...
<vulnerable_code> conn.close() if __name__ == "__main__": from test.support import suppress_msvcrt_asserts <commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code> conn.close() def test_sqlite3(): import sqlite3 def hook(event, *a...
<vulnerable_code> ["gc.get_objects", "gc.get_referrers", "gc.get_referents"] ) def test_http(self): import_helper.import_module("http.client") returncode, events, stderr = self.run_python("test_http_client") self.assertIn('HTTP', events[1][2]) if __name__ == "__main...
<vulnerable_code>{ int rc; if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { return NULL; } int rc; char* errmsg; if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { return NULL; }<commit_title>[PATCH 003/413] bpo-43651: Fix Encodin...
<vulnerable_code> } result = PyObject_Call(factory, args, kwargs); return result; }<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code> } result = PyObject_Call(factory, args, kwargs); if (result == NULL) { return NULL; ...
<vulnerable_code> self.assertNotIn("somethingverywronghehe", err.getvalue()) def test_name_error_suggestions_do_not_trigger_for_too_many_locals(self): def f(): # Mutating locals() is unreliable, so we need to do it by hand self.assertNotIn("blech", err.getvalue()) def test...
<vulnerable_code> if (current_distance == -1) { return NULL; } if (current_distance == 0 || current_distance > MAX_DISTANCE) { continue; } if (!suggestion || current_distance < suggestion_distance) {<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarni...
<vulnerable_code>def pipepager(text, cmd): """Page through text by feeding it to another program.""" import subprocess proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE) try: with io.TextIOWrapper(proc.stdin, errors='backslashreplace') as pipe: try: pipe....
<vulnerable_code> buffer = io.BufferedWriter(raw, buffering) if binary: return buffer text = io.TextIOWrapper(buffer, encoding, errors, newline) text.mode = mode return text<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_de...
<vulnerable_code> for mode in 'r', 'rb', 'rw', 'w', 'wb': with self.subTest(mode=mode): with socket.socket() as sock: with sock.makefile(mode) as fp: self.assertEqual(fp.mode, mode) def test_makefile_invalid_mode(self): if not hasat...
<vulnerable_code> val = str(self) # mix-in branch else: cls = self._member_type_ val = self._value_ return cls.__format__(val, format_spec)<commit_title>[PATCH 003/413] bpo-43651: Fix EncodingWarning in test_io (GH-25097)<commit_description><fixed_code> ...
<vulnerable_code> self.assertEqual(str(TestFloat.one), 'one') self.assertEqual('{}'.format(TestFloat.one), 'TestFloat success!') def assertFormatIsValue(self, spec, member): self.assertEqual(spec.format(member), spec.format(member.value)) <commit_title>[PATCH 003/413] bpo-43651: Fix Encoding...