Staging
v0.5.1
v0.5.1
https://github.com/python/cpython
Revision 7316c6d4a57931e9786c06eae168b227d7463317 authored by Christian Heimes on 05 September 2017, 14:00:44 UTC, committed by GitHub on 05 September 2017, 14:00:44 UTC
* Change NPN detection: Version breakdown, support disabled (pre-patch/post-patch): - pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will be defined -> True/False Version breakdown support enabled (pre-patch/post-patch): - pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True - 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True * Refine NPN guard: - If NPN is disabled, but ALPN is available we need our callback - Make clinic's ssl behave the same way This created a working ssl module for me, with NPN disabled and ALPN enabled for OpenSSL 1.1.0f. Concerns to address: The initial commit for NPN support into OpenSSL [1], had the OPENSSL_NPN_* variables defined inside the OPENSSL_NO_NEXTPROTONEG guard. The question is if that ever made it into a release. This would need an ugly hack, something like: GH-if defined(OPENSSL_NO_NEXTPROTONEG) && \ !defined(OPENSSL_NPN_NEGOTIATED) GH- define OPENSSL_NPN_UNSUPPORTED 0 GH- define OPENSSL_NPN_NEGOTIATED 1 GH- define OPENSSL_NPN_NO_OVERLAP 2 GH-endif [1] https://github.com/openssl/openssl/commit/68b33cc5c7 (cherry picked from commit b2d096b)
1 parent e2543a6
Tip revision: 7316c6d4a57931e9786c06eae168b227d7463317 authored by Christian Heimes on 05 September 2017, 14:00:44 UTC
[3.6] bpo-30622: Change NPN detection: (GH-2079) (#3314)
[3.6] bpo-30622: Change NPN detection: (GH-2079) (#3314)
Tip revision: 7316c6d
symtablemodule.c
#include "Python.h"
#include "code.h"
#include "Python-ast.h"
#include "symtable.h"
static PyObject *
symtable_symtable(PyObject *self, PyObject *args)
{
struct symtable *st;
PyObject *t;
char *str;
PyObject *filename;
char *startstr;
int start;
if (!PyArg_ParseTuple(args, "sO&s:symtable",
&str, PyUnicode_FSDecoder, &filename, &startstr))
return NULL;
if (strcmp(startstr, "exec") == 0)
start = Py_file_input;
else if (strcmp(startstr, "eval") == 0)
start = Py_eval_input;
else if (strcmp(startstr, "single") == 0)
start = Py_single_input;
else {
PyErr_SetString(PyExc_ValueError,
"symtable() arg 3 must be 'exec' or 'eval' or 'single'");
Py_DECREF(filename);
return NULL;
}
st = Py_SymtableStringObject(str, filename, start);
Py_DECREF(filename);
if (st == NULL)
return NULL;
t = (PyObject *)st->st_top;
Py_INCREF(t);
PyMem_Free((void *)st->st_future);
PySymtable_Free(st);
return t;
}
static PyMethodDef symtable_methods[] = {
{"symtable", symtable_symtable, METH_VARARGS,
PyDoc_STR("Return symbol and scope dictionaries"
" used internally by compiler.")},
{NULL, NULL} /* sentinel */
};
static struct PyModuleDef symtablemodule = {
PyModuleDef_HEAD_INIT,
"_symtable",
NULL,
-1,
symtable_methods,
NULL,
NULL,
NULL,
NULL
};
PyMODINIT_FUNC
PyInit__symtable(void)
{
PyObject *m;
if (PyType_Ready(&PySTEntry_Type) < 0)
return NULL;
m = PyModule_Create(&symtablemodule);
if (m == NULL)
return NULL;
PyModule_AddIntMacro(m, USE);
PyModule_AddIntMacro(m, DEF_GLOBAL);
PyModule_AddIntMacro(m, DEF_LOCAL);
PyModule_AddIntMacro(m, DEF_PARAM);
PyModule_AddIntMacro(m, DEF_FREE);
PyModule_AddIntMacro(m, DEF_FREE_CLASS);
PyModule_AddIntMacro(m, DEF_IMPORT);
PyModule_AddIntMacro(m, DEF_BOUND);
PyModule_AddIntMacro(m, DEF_ANNOT);
PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionBlock);
PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock);
PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock);
PyModule_AddIntMacro(m, LOCAL);
PyModule_AddIntMacro(m, GLOBAL_EXPLICIT);
PyModule_AddIntMacro(m, GLOBAL_IMPLICIT);
PyModule_AddIntMacro(m, FREE);
PyModule_AddIntMacro(m, CELL);
PyModule_AddIntConstant(m, "SCOPE_OFF", SCOPE_OFFSET);
PyModule_AddIntMacro(m, SCOPE_MASK);
if (PyErr_Occurred()) {
Py_DECREF(m);
m = 0;
}
return m;
}
Computing file changes ...