Skip to content

Instantly share code, notes, and snippets.

View carljm's full-sized avatar

Carl Meyer carljm

View GitHub Profile
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index b2dd32f925e..09396b87245 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1780,6 +1780,13 @@ are always available. They are listed here in alphabetical order.
the second argument is a type, ``issubclass(type2, type)`` must be true (this
is useful for classmethods).
+ When called directly within an ordinary method of a class, both arguments may
+ be omitted ("zero-argument :func:`super`"). In this case, *type* will be the
void _PyST_Dump(PySTEntryObject* ste, PyObject* prefix)
{
const char *blocktype;
switch(ste->ste_type) {
case FunctionBlock: blocktype = "FunctionBlock"; break;
case ClassBlock: blocktype = "ClassBlock"; break;
case ModuleBlock: blocktype = "ModuleBlock"; break;
case AnnotationBlock: blocktype = "AnnotationBlock"; break;
case TypeVarBoundBlock: blocktype = "TypeVarBoundBlock"; break;
case TypeAliasBlock: blocktype = "TypeAliasBlock"; break;
mainopt.json
============
Performance version: 1.0.6
Report on Linux-5.15.0-1028-aws-x86_64-with-glibc2.31
Number of logical CPUs: 72
Start date: 2023-02-13 15:59:52.702512
End date: 2023-02-13 16:37:24.927583
ic2opt.json
~$ bench-jobs compare req-compile-bench-1664914413-esnow req-compile-bench-1664903905-esnow
All benchmarks:
===============
+-------------------------+------------------------------------------------------------------+------------------------------------------------------------------+
| Benchmark | req-compile-bench-1664914413-esnow/pyperformance-results.json.gz | req-compile-bench-1664903905-esnow/pyperformance-results.json.gz |
+=========================+==================================================================+==================================================================+
| unpickle | 13.7 us | 13.2 us: 1.04x faster |
+-------------------------+------------------------------------------------------------------+------------------------------------------------------------------+
diff --git a/mypy/semanal.py b/mypy/semanal.py
index 7bac809..33d798f 100644
--- a/mypy/semanal.py
+++ b/mypy/semanal.py
@@ -2943,21 +2943,9 @@ class SemanticAnalyzer(NodeVisitor):
if isinstance(base.node, TypeInfo):
# C.bar where C is a class
type_info = base.node
- elif isinstance(base.node, Var) and self.function_stack:
- # check for self.bar or cls.bar in method/classmethod
class TransactionMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
with transaction.atomic():
response = self.get_response(request)
if response.status_code == 500:
transaction.set_rollback()
return response
@carljm
carljm / envsettings.py
Created April 13, 2016 19:07
Django settings from env.
"""Utility for pulling settings from the environment."""
import os
from urllib.parse import urlparse
class EnvParser:
"""Utility for getting settings from the OS environ.
Instantiate with the name of an env var to get the current mode from (that
env var should be set to one of VALID_MODES, or not set), then call the
@carljm
carljm / jinja2backend.py
Created June 14, 2015 21:21
Django Jinja2 backend subclass with context processor support
class Jinja2Backend(jinja2backend.Jinja2):
def __init__(self, params):
self.context_processors = [
import_string(p)
for p in params['OPTIONS'].pop('context_processors', [])
]
super(Jinja2Backend, self).__init__(params)
@carljm
carljm / test.py
Created March 24, 2015 01:07
playing with logging
from logging.config import dictConfig
import logging
initial = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
},
@carljm
carljm / patch.diff
Created February 12, 2015 00:00
draft patch for --fake-initial doc updates
diff --git a/docs/topics/migrations.txt b/docs/topics/migrations.txt
index a0dc365..fae87a0 100644
--- a/docs/topics/migrations.txt
+++ b/docs/topics/migrations.txt
@@ -148,6 +148,13 @@ developers (or your production servers) check out the code, they'll
get both the changes to your models and the accompanying migration at the
same time.
+.. versionadded:: 1.8
+