100% found this document useful (2 votes)
15 views

Inside The Python Virtual Machine Obi Ikenwosu pdf download

The document is a promotional description for the book 'Inside The Python Virtual Machine' by Obi Ikenwosu, which provides an in-depth exploration of how Python programs are executed within the CPython interpreter. It covers various phases of execution including initialization, compiling, and interpreting, and is aimed at readers familiar with Python and C. The book is available for purchase on Leanpub and includes references to other related resources and books.

Uploaded by

weqinigabour87
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
15 views

Inside The Python Virtual Machine Obi Ikenwosu pdf download

The document is a promotional description for the book 'Inside The Python Virtual Machine' by Obi Ikenwosu, which provides an in-depth exploration of how Python programs are executed within the CPython interpreter. It covers various phases of execution including initialization, compiling, and interpreting, and is aimed at readers familiar with Python and C. The book is available for purchase on Leanpub and includes references to other related resources and books.

Uploaded by

weqinigabour87
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Inside The Python Virtual Machine Obi Ikenwosu

download

https://ebookbell.com/product/inside-the-python-virtual-machine-
obi-ikenwosu-11263784

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Python The Stress Free Way To Learning Python Inside And Out It
Academy

https://ebookbell.com/product/python-the-stress-free-way-to-learning-
python-inside-and-out-it-academy-5903274

Python Academy The Stress Free Way To Learning Python Inside Out
Beginner It Academy

https://ebookbell.com/product/python-academy-the-stress-free-way-to-
learning-python-inside-out-beginner-it-academy-42933166

Leaving The Rat Race With Python An Insiders Guide To Freelance


Developing Christian Mayer

https://ebookbell.com/product/leaving-the-rat-race-with-python-an-
insiders-guide-to-freelance-developing-christian-mayer-44990992

Inside The Writers Room Conversations With American Tv Writers 1st


Edition Christina Kallas

https://ebookbell.com/product/inside-the-writers-room-conversations-
with-american-tv-writers-1st-edition-christina-kallas-46620134
Inside The Not So Big House Discovering The Details That Bring A Home
To Life Sarah Susanka

https://ebookbell.com/product/inside-the-not-so-big-house-discovering-
the-details-that-bring-a-home-to-life-sarah-susanka-46772352

Inside The Mind Of Toyota Management Principles For Enduring Growth


Satoshi Hino

https://ebookbell.com/product/inside-the-mind-of-toyota-management-
principles-for-enduring-growth-satoshi-hino-48192510

Inside The Montreal Mafia The Confessions Of Andrew Scoppa Flix Sguin

https://ebookbell.com/product/inside-the-montreal-mafia-the-
confessions-of-andrew-scoppa-flix-sguin-48273906

Inside The Magic The Making Of Fantastic Beasts And Where To Find Them
Ian Nathan

https://ebookbell.com/product/inside-the-magic-the-making-of-
fantastic-beasts-and-where-to-find-them-ian-nathan-48356796

Inside The Lost Museum Curating Past And Present Steven Lubar

https://ebookbell.com/product/inside-the-lost-museum-curating-past-
and-present-steven-lubar-48748634
Inside The Python Virtual Machine
Obi Ike-Nwosu
This book is for sale at http://leanpub.com/insidethepythonvirtualmachine

This version was published on 2018-11-05

This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing
process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and
many iterations to get reader feedback, pivot until you have the right book and build traction once
you do.

© 2015 - 2018 Obi Ike-Nwosu


Also By Obi Ike-Nwosu
Intermediate Python
Contents

1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2. The View From 30,000ft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3. Compiling Python Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9


3.1 From Source To Parse Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Python tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3 From Parse Tree To Abstract Syntax Tree . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.4 Building The Symbol Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.5 From AST To Code Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

4. Python Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.1 PyObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.2 Under the cover of Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.3 Type Object Case Studies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.4 Minting type instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.5 Objects and their attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.6 Method Resolution Order (MRO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

5. Code Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.1 Exploring code objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.2 Code Objects within other code objects . . . . . . . . . . . . . . . . . . . . . . . . . . 68
5.3 Code Objects in the VM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

6. Frames Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
6.1 Allocating Frame Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

7. Interpreter and Thread States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76


7.1 The Interpreter state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
7.2 The Thread state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

8. Intermezzo: The abstract.c Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

9. The evaluation loop, ceval.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88


9.1 Putting names in place . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
9.2 The parts of the machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
CONTENTS

9.3 The Evaluation loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94


9.4 A sampling of opcodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

10. The Block Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104


10.1 A Short Note on Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

11. From Class code to bytecode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

12. Generators: Behind the scenes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117


12.1 The Generator object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
12.2 Running a generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
1. Introduction
The Python Programming language has been around for quite a while. Development work was
started on the first version by Guido Van Rossum in 1989 and it has since grown to become one of
the more popular languages that has been used in applications ranging from graphical interfaces to
financial¹ and data analysis² applications.
This write-up aims to go behind the scene of the Python interpreter and provide a conceptual
overview of how a python program is executed. This material targets CPython which as of this
writing is the most popular implementation of Python and is considered the standard.

Python and CPython are used interchangeably in this text but any mention of Python
refers to CPython which is the version of python implemented in C. Other implementations
include PyPy which is python implemented in a restricted subset of Python, Jython which
is python implemented on the Java Virtual Machine etc.

I like to think of the execution of a python program as split into two or three main phases as listed
below depending on how the interpreter is invoked. These are covered in different measures within
this write-up:

1. Initialization : This involves the set up of the various data structures needed by the python
process. This will probably only counts when a program is being executed non-interactively
through the interpreter shell.
2. Compiling : This involves activities such as parsing source code to build syntax trees, creation
of abstract syntax trees, building of symbol tables and generation of code objects.
3. Interpreting : This involves the actual execution of generated code objects within some context.

The process of generating parse trees and abstract syntax trees from source code is language agnostic
so the same methods that apply to other languages also apply to Python; as a result, not much
is on this subject is covered here. On the other hand, the process of building symbol tables and
code objects from the Abstract Syntax tree is the more interesting part of the compilation phase
which is handled in a more or less python specific way and attention is paid to it. The interpreting
of compiled code objects and all the data structures that are used in the process is also covered.
Topics that will be touched upon include but are not limited to the process of building symbol tables
and generating code objects, python objects, frame objects, code objects, function objects, python
opcodes, the interpreter loop, generators and user defined classes.
¹http://tpq.io/
²http://pandas.pydata.org/
Introduction 2

This material is aimed at anybody that is interested in gaining some insight into how the
CPython virtual machine functions. It is assumed that the user is already familiar with python and
understands the fundamentals of the language. As part of this expose on the virtual machine, we go
through a considerable amount of C code so a user that has a rudimentary understanding of C will
find it easier to follow. After all said and done, all that is needed to get through this material is a
healthy desire to want to learn about the CPython virtual machine.
This work is an expanded version of personal notes taken while investigating the inner working of
the python interpreter. There is substantial amount of wisdoms in videos available in Pycon videos³,
school lectures⁴ and blog write-ups⁵. This work will not be complete without acknowledging these
fantastic sources that have been leveraged in the production of this work.
At the end of this book, a user should be able to understand the intricacies of how the Python
interpreter executes a program. This includes the various steps involved in executing the program
and the various data structures that are crucial to the execution of such program. We start off with
a gentle bird’s eye view of what happens when a trivial program is executed by passing the module
name to the interpreter at the commandline. The CPython executable can be installed from source
by following the instructions at the Python Developer’s Guide⁶.

Python version 3 is used throughout this material.

³https://www.youtube.com/watch?v=XGF3Qu4dUqk
⁴http://pgbovine.net/cpython-internals.htm/
⁵https://tech.blog.aknin.name/2010/04/02/pythons-innards-introduction/
⁶https://docs.python.org/devguide/index.html#
2. The View From 30,000ft
This chapter provides a high level expose on how the interpreter goes about executing a python
program. In subsequent chapters, we zoom in on the various pieces of puzzle and provide a more
detailed description of such pieces. Regardless of the complexity of a python program, this process is
the same. The excellent explanation of this process provided by Yaniv Aknin in his Python Internal
series¹ provides some of the basis and motivation for this discussion.
Given a python module, test.py, this module can be executed at the command line by passing it
as an argument to the python interpreter program as such $python test.py. This is just one of the
ways of the invoking the python executable - we could start the interactive interpreter, execute a
string as code etc but these other methods of execution are not of interest to us. When the module
is passed as an argument to the executable on the command line, figure 2.1 best captures the flow
of various activities that are involved in the actual execution of the supplied module.

Figure 2.1: Flow during execution of source code

The python executable is a C program just like any other C program such as the linux kernel or
a simple hello world program in C so pretty much the same process happens when the python
executable is invoked. Take a moment to grasp this, the python executable is just another program
that runs your own program. The same argument can be made for the relationship between C and
assembly or llvm. The standard process initialization which depends on the platform the executable
is running on starts once the python executable is invoked with module name as argument,
¹https://tech.blog.aknin.name/2010/04/02/pythons-innards-introduction/
The View From 30,000ft 4

This writeup assumes a unix based operating system so some speicifics may differ when a
windows operating system is being used.

The C runtime performs all its initialisation magic - libraries are loaded, environment variables are
checked or set then the python executable’s main method is run just like any other C program.
The python executable’s main program is located in the ./Programs/python.c file and it handles
some initialization such as making copies of program command line arguments that were passed
to the module. The main function then calls the Py_Main function located in the ./Modules/main.c
which handles the interpreter initialization process - parsing commandline arguments and setting
program flags², reading environment variables, running hooks, carrying out hash randomization etc.
As part of the initialization process, Py_Initialize from pylifecycle.c is called; this handles the
initialization of the interpreter and thread state data structures - two very important data structures.
A look at the data structures definitions for the interpreter and thread states provides some context
into the functions of these data structures. The interpreter and thread states are just structures
with pointers to fields that hold information that is required for the execution of a program. The
interpreter state typedef (just assume that this is C lingo for type definition though this is not entirely
true) is provided in listing 2.1.
Listing 2.1: The interpreter state data structure
1 typedef struct _is {
2
3 struct _is *next;
4 struct _ts *tstate_head;
5
6 PyObject *modules;
7 PyObject *modules_by_index;
8 PyObject *sysdict;
9 PyObject *builtins;
10 PyObject *importlib;
11
12 PyObject *codec_search_path;
13 PyObject *codec_search_cache;
14 PyObject *codec_error_registry;
15 int codecs_initialized;
16 int fscodec_initialized;
17
18 PyObject *builtins_copy;
19 } PyInterpreterState;

Anyone who has used the Python programming language long enough may recognize a few of the
fields mentioned in this structure (sysdict, builtins, codec)*.
²https://docs.python.org/3.6/using/cmdline.html
The View From 30,000ft 5

1. The *next field is a reference to another interpreter instance as multiple python interpreters
can exist within the same process.
2. The *tstate_head field points to the main thread of execution - in the event that the python
program is multithreaded then the interpreter is shared by all threads created by the program
- the structure of a thread state is discussed shortly.
3. The modules, modules_by_index, sysdict, builtins and importlib are self explanatory - they
are all defined as instances of PyObject which is the root type for all python objects in the
virtual machine world. Python objects are covered in more detail in the chapters that will
follow.
4. The codec* related fields hold information that help with the location and loading of encodings.
These are very important for decoding bytes.

The execution of a program must occur within a thread. The thread state structure contains all the
information that is needed by a thread to execute python some code object - a part of the thread
data structure is shown in listing 2.2.
Listing 2.2: A cross-section of the thread state data structure

1 typedef struct _ts {


2 struct _ts *prev;
3 struct _ts *next;
4 PyInterpreterState *interp;
5
6 struct _frame *frame;
7 int recursion_depth;
8 char overflowed;
9
10 char recursion_critical;
11 int tracing;
12 int use_tracing;
13
14 Py_tracefunc c_profilefunc;
15 Py_tracefunc c_tracefunc;
16 PyObject *c_profileobj;
17 PyObject *c_traceobj;
18
19 PyObject *curexc_type;
20 PyObject *curexc_value;
21 PyObject *curexc_traceback;
22
23 PyObject *exc_type;
24 PyObject *exc_value;
25 PyObject *exc_traceback;
26
The View From 30,000ft 6

27 PyObject *dict; /* Stores per-thread state */


28 int gilstate_counter;
29
30 ...
31 } PyThreadState;

The interpreter and the thread state data structures are discussed in more details in subsequent
chapters. The initialization process also sets up the import mechanisms as well as rudimentary stdio.
Once all the initialization is complete, the Py_Main function invokes the run_file function also
located in the main.c module. The following series of function calls: PyRun_AnyFileExFlags ->
PyRun_SimpleFileExFlags->PyRun_FileExFlags->PyParser_ASTFromFileObject are made to the
PyParser_ASTFromFileObject function. The PyRun_SimpleFileExFlags function call creates the
__main__ namespace in which the file contents will be executed. It also checks if a pyc version
of the file exists - the pyc file is just a file containing the compiled version of the file being
executed. In the case that the file has a pyc version then an attempt will be made to read it in
as binary and then run it. In this case, there is no pyc file so the PyRun_FileExFlags is called and
so on. The PyParser_ASTFromFileObject function calls the PyParser_ParseFileObject which reads
the module content and builds a parse tree from it. The parse tree created is then passed to the
PyParser_ASTFromNodeObject which then goes ahead to create an abstract syntax tree from the
parse tree.

If you have been following the actual C source code by now you must have run into the
Py_INCREF and Py_DECREF by now. These are memory management functions that will be
discussed later on in more details. CPython manages the object life cycle using reference
counting; whenever a new reference to an object is made the reference is increased with the
Py_INCREF while whenever a reference goes out of scope the reference is reduced with the
Py_DECREF functions.

The AST generated is then passed to the run_mod function. This function invokes the PyAST_-
CompileObject function that creates code objects from the AST. Do note that the bytecode generated
during the call to PyAST_CompileObject is passed through a simple peephole optimizer that carries
out low hanging optimization of the generated bytecode before the code objects are created.
The run_mod function then invokes PyEval_EvalCode from the ceval.c file on the code object.
This results in another series of function call: PyEval_EvalCode->PyEval_EvalCode->_PyEval_-
EvalCodeWithName->_PyEval_EvalFrameEx function calls. The code object is passed as an argument
into most each of these functions in one form or another. The _PyEval_EvalFrameEx is the atual
interpreter loop that handles the execution of code objects. It is however not just invoked with a
code object as argument rather a frame object with has a field that references a code object is one
of its arguments. This frame object provides the context for the execution of the code object. A very
simplified version of what happens here is that the interpreter loop continuously reads the next
instruction pointed to by the instruction counter from an array of instructions. It then executes this
instruction - adding or removing objects from the value stack in the process (where is this value
The View From 30,000ft 7

stack), till there are no more instructions to be executed in the array or something exceptional that
breaks this loop occurs.
Python provides a set of functions that one can use to explore actual code objects. For example, a
simple program can be compiled into a code object and disassembled to get the opcodes that are
executed by the python virtual machine as shown in listing 2.3.
Listing 2.3: Disassembling a python function

1 >>> def square(x):


2 ... return x*x
3 ...
4
5 >>> dis(square)
6 2 0 LOAD_FAST 0 (x)
7 2 LOAD_FAST 0 (x)
8 4 BINARY_MULTIPLY
9 6 RETURN_VALUE

The ./Include/opcodes.h header file contains a full listing of all the instruction/opcodes for the
python virtual machine. The opcodes are pretty straight forward conceptually. Take our example
from listing 2.3 that has a set of four instructions - the LOAD_FAST loads the value of the its
argument (x in this case) onto an evaluation (value) stack. The python virtual machine is a stack
based virtual machine so this means that values for evaluations by an opcode are gotten from a
stack and results of an evaluation are placed back on the stack for further use by other opcodes. The
BINARY_MULTIPLY opcode then pops two items from the value stack, performs binary multiplication
on both values and places the result of the binary multiplication back on the value stack. The RETURN
VALUE instruction pops a value from the stack, sets the return value to object to this value and breaks
out of the interpreter loop. From the disassembly in listing 2.3, it is pretty clear that this rather
simplistic
explanation of the operation of the interpreter loop leaves out a number of details that will be
discussed in subsequent chapters. A few of these outstanding questions may include.

1. Where are the values such as that loaded by the LOAD_FAST instruction gotten from
?
2. Where do arguments that are used as part of instructions come from ?
3. How are nested function and method calls managed ? 4 How does the interpreter loop
handle exceptions ?

After all the instructions have been the executed, the Py_Main function continues its execution
but this time around it starts the clean up process. Just as Py_Initialize was called to perform
The View From 30,000ft 8

initialization during the interpreter startup, Py_FinalizeEx is invoked to do some clean-up work;
this clean-up process involves waiting for threads to exit, calling any exit hooks and also freeing up
any memory allocated by the interpreter that is still in use.
The above description is a high-level description of the processes the python executable goes through
to execute a python program. As noted previously, alot of details are stil left to be answered and in
the chapters that will follow, we will dig into each of the stages that have been covered and try
to provide details on each of these stages. We get into action starting with a description of the
compilation process in the next chapter.
Other documents randomly have
different content
— Town Malling, i. 226

— with Two Necks, Gresham Street, i. 54-56

Tabard, Southwark, i. 77-79

Talbot, Atcham, ii. 80

— Cuckfield, ii. 81

— Newark, i. 308

— Ripley, ii. 213

— Shrewsbury, ii. 80

— Southwark, i. 79

— Towcester, ii. 115, 243

Tan Hill Inn, Swaledale, near Brough, ii. 145

Tankard, Ipswich, ii. 110

Thorn, Appleton, ii. 138

Three Cats, Sevenoaks, ii. 191

— Cocks, near Hay, ii. 47

— Crosses, Willoughby, ii. 303

— Crowns, Chagford, i. 170-172

— Horseshoes, Great Mongeham, ii. 197


— Houses, Sandal, i. 308

— Jolly Bargemen, Cooling, i. 295

— Magpies, Sipson Green, i. 317

— Queens, Burton-on-Trent, ii. 114

— Tuns, Bideford, ii. 110

Town Arms, Eatanswill, i. 230

Traveller’s Rest, Flash Bar, ii. 148

— Kirkstone Pass, ii. 148

Treaty House, Uxbridge, i. 161-169

Trevelyan Arms, Barnstaple, ii. 40, 110

Trip to Jerusalem, Nottingham, ii. 134

Trouble House, near Tetbury, ii. 203

Turnspit Dogs, i. 48-51

Turpin’s Cave, Epping Forest, i. 310

Uncle Tom’s Cabin, Bluepitts, near Rochdale, ii. 197

Unicorn, Bowes, i. 269

— Ripon, ii. 121


Verulam Arms, St. Albans, ii. 79

Vine, Mile-End, ii. 259

Vision of Piers Plowman, i. 16-18

Visitors’ Books, ii. 291-308

Waggon and Horses, Beckhampton, i. 233, 237

Wellington, Broadstairs, ii. 47

— Market Place, Manchester, i. 7

— Rushyford Bridge, i. 60

— Tewkesbury, ii. 287

Whetstone, Chiswick Mall, ii. 124

White Bear, Fickles Hole, ii. 203

— and Whetstone, Chiswick Mall, ii. 123-125

— Bull, Ribchester, ii. 119-121

White Hart, Adwalton, ii. 255

— Aylesbury, i. 62-67, 140

— Bath, i. 254

— Castle Combe, ii. 234

D ighlington ii 255
— Drighlington, ii. 255

— Eatanswill, i. 230

— Glastonbury, i. 112

— Godstone, ii. 30-34

— Guildford, ii. 55

— Hackney Marshes, ii. 257-259

— Scole, ii. 150

— Somerton, i. 185-187

— Southwark, i. 226-228

— Whitchurch, Hants, ii. 280

— Widcombe, i. 254

— Yard, Gray’s Inn Road, ii. 106

White Horse, Eaton Socon, i. 267

— Fetter Lane, i. 31, 219

— Maiden Newton, ii. 289

— Shere, ii. 241

— Woolstone, ii. 211

White Horse Cellar, Piccadilly, i. 253

White Ho se Hackne Ma shes ii 259


White House, Hackney Marshes, ii. 259

White Lion, Maidstone, i. 226

White Swan, Henley-in-Arden, ii. 300

Who’d Have Thought It, Barking, ii. 204

Why Not, Dover, ii. 204

Widow’s Son, Bromley-by-Bow, ii. 125-127

Windmill, North Cheriton, ii. 89-91

— Salt Hill, i. 60

— Tabley, ii. 179

Winterslow Hut, near Salisbury, ii. 102

Wizard, Alderley Edge, ii. 65-69

Wood’s Hotel, Furnival’s Inn, i. 31

World Turned Upside Down, Old Kent Road, ii. 204

— near Three Mile Cross, ii. 204

Wright’s, Rochester, i. 223-225

Yacht, Chester, ii. 77, 304

Printed and bound by Hazell, Watson & Viney, Ld., London and
Aylesbury.
Footnotes:
[1] The Great North Road, 1901, vol. i., pp. 260-66.
[2] The sign of “Scole White Hart,” illustrated in Norwich Road, p.
265.
[3] Illustrated: Brighton Road, pp. 333, 337.
[4] Illustrated: Brighton Road, p. 295.
[5] Illustrated: Norwich Road, p. 256.
[6] It is now the “Dolphin,” and numbered 269.
[7] Cf. The Hastings Road, p. 82.
[8] The Holyhead Road, vol. i., pp. 244-7; Stage Coach and Mail in
Days of Yore, vol. i., p. 46.
*** END OF THE PROJECT GUTENBERG EBOOK THE OLD INNS OF
OLD ENGLAND, VOLUME 2 (OF 2) ***

Updated editions will replace the previous one—the old editions


will be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States
copyright in these works, so the Foundation (and you!) can copy
and distribute it in the United States without permission and
without paying copyright royalties. Special rules, set forth in the
General Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the


free distribution of electronic works, by using or distributing this
work (or any other work associated in any way with the phrase
“Project Gutenberg”), you agree to comply with all the terms of
the Full Project Gutenberg™ License available with this file or
online at www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand,
agree to and accept all the terms of this license and intellectual
property (trademark/copyright) agreement. If you do not agree
to abide by all the terms of this agreement, you must cease
using and return or destroy all copies of Project Gutenberg™
electronic works in your possession. If you paid a fee for
obtaining a copy of or access to a Project Gutenberg™
electronic work and you do not agree to be bound by the terms
of this agreement, you may obtain a refund from the person or
entity to whom you paid the fee as set forth in paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only


be used on or associated in any way with an electronic work by
people who agree to be bound by the terms of this agreement.
There are a few things that you can do with most Project
Gutenberg™ electronic works even without complying with the
full terms of this agreement. See paragraph 1.C below. There
are a lot of things you can do with Project Gutenberg™
electronic works if you follow the terms of this agreement and
help preserve free future access to Project Gutenberg™
electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright
law in the United States and you are located in the United
States, we do not claim a right to prevent you from copying,
distributing, performing, displaying or creating derivative works
based on the work as long as all references to Project
Gutenberg are removed. Of course, we hope that you will
support the Project Gutenberg™ mission of promoting free
access to electronic works by freely sharing Project Gutenberg™
works in compliance with the terms of this agreement for
keeping the Project Gutenberg™ name associated with the
work. You can easily comply with the terms of this agreement
by keeping this work in the same format with its attached full
Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.

1.E. Unless you have removed all references to Project


Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project
Gutenberg™ work (any work on which the phrase “Project
Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed,
viewed, copied or distributed:

This eBook is for the use of anyone anywhere in the United


States and most other parts of the world at no cost and
with almost no restrictions whatsoever. You may copy it,
give it away or re-use it under the terms of the Project
Gutenberg License included with this eBook or online at
www.gutenberg.org. If you are not located in the United
States, you will have to check the laws of the country
where you are located before using this eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is


derived from texts not protected by U.S. copyright law (does not
contain a notice indicating that it is posted with permission of
the copyright holder), the work can be copied and distributed to
anyone in the United States without paying any fees or charges.
If you are redistributing or providing access to a work with the
phrase “Project Gutenberg” associated with or appearing on the
work, you must comply either with the requirements of
paragraphs 1.E.1 through 1.E.7 or obtain permission for the use
of the work and the Project Gutenberg™ trademark as set forth
in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is


posted with the permission of the copyright holder, your use and
distribution must comply with both paragraphs 1.E.1 through
1.E.7 and any additional terms imposed by the copyright holder.
Additional terms will be linked to the Project Gutenberg™
License for all works posted with the permission of the copyright
holder found at the beginning of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute


this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™
works unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or


providing access to or distributing Project Gutenberg™
electronic works provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project


Gutenberg™ electronic work or group of works on different
terms than are set forth in this agreement, you must obtain
permission in writing from the Project Gutenberg Literary
Archive Foundation, the manager of the Project Gutenberg™
trademark. Contact the Foundation as set forth in Section 3
below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on,
transcribe and proofread works not protected by U.S. copyright
law in creating the Project Gutenberg™ collection. Despite these
efforts, Project Gutenberg™ electronic works, and the medium
on which they may be stored, may contain “Defects,” such as,
but not limited to, incomplete, inaccurate or corrupt data,
transcription errors, a copyright or other intellectual property
infringement, a defective or damaged disk or other medium, a
computer virus, or computer codes that damage or cannot be
read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in
paragraph 1.F.3, the Project Gutenberg Literary Archive
Foundation, the owner of the Project Gutenberg™ trademark,
and any other party distributing a Project Gutenberg™ electronic
work under this agreement, disclaim all liability to you for
damages, costs and expenses, including legal fees. YOU AGREE
THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE, STRICT
LIABILITY, BREACH OF WARRANTY OR BREACH OF CONTRACT
EXCEPT THOSE PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE
THAT THE FOUNDATION, THE TRADEMARK OWNER, AND ANY
DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE
TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL,
PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE
NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of
receiving it, you can receive a refund of the money (if any) you
paid for it by sending a written explanation to the person you
received the work from. If you received the work on a physical
medium, you must return the medium with your written
explanation. The person or entity that provided you with the
defective work may elect to provide a replacement copy in lieu
of a refund. If you received the work electronically, the person
or entity providing it to you may choose to give you a second
opportunity to receive the work electronically in lieu of a refund.
If the second copy is also defective, you may demand a refund
in writing without further opportunities to fix the problem.

1.F.4. Except for the limited right of replacement or refund set


forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’,
WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of
damages. If any disclaimer or limitation set forth in this
agreement violates the law of the state applicable to this
agreement, the agreement shall be interpreted to make the
maximum disclaimer or limitation permitted by the applicable
state law. The invalidity or unenforceability of any provision of
this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the


Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and
distribution of Project Gutenberg™ electronic works, harmless
from all liability, costs and expenses, including legal fees, that
arise directly or indirectly from any of the following which you
do or cause to occur: (a) distribution of this or any Project
Gutenberg™ work, (b) alteration, modification, or additions or
deletions to any Project Gutenberg™ work, and (c) any Defect
you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new
computers. It exists because of the efforts of hundreds of
volunteers and donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project
Gutenberg™’s goals and ensuring that the Project Gutenberg™
collection will remain freely available for generations to come. In
2001, the Project Gutenberg Literary Archive Foundation was
created to provide a secure and permanent future for Project
Gutenberg™ and future generations. To learn more about the
Project Gutenberg Literary Archive Foundation and how your
efforts and donations can help, see Sections 3 and 4 and the
Foundation information page at www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-
profit 501(c)(3) educational corporation organized under the
laws of the state of Mississippi and granted tax exempt status
by the Internal Revenue Service. The Foundation’s EIN or
federal tax identification number is 64-6221541. Contributions
to the Project Gutenberg Literary Archive Foundation are tax
deductible to the full extent permitted by U.S. federal laws and
your state’s laws.

The Foundation’s business office is located at 809 North 1500


West, Salt Lake City, UT 84116, (801) 596-1887. Email contact
links and up to date contact information can be found at the
Foundation’s website and official page at
www.gutenberg.org/contact
Section 4. Information about Donations to
the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission
of increasing the number of public domain and licensed works
that can be freely distributed in machine-readable form
accessible by the widest array of equipment including outdated
equipment. Many small donations ($1 to $5,000) are particularly
important to maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws


regulating charities and charitable donations in all 50 states of
the United States. Compliance requirements are not uniform
and it takes a considerable effort, much paperwork and many
fees to meet and keep up with these requirements. We do not
solicit donations in locations where we have not received written
confirmation of compliance. To SEND DONATIONS or determine
the status of compliance for any particular state visit
www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states


where we have not met the solicitation requirements, we know
of no prohibition against accepting unsolicited donations from
donors in such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot


make any statements concerning tax treatment of donations
received from outside the United States. U.S. laws alone swamp
our small staff.

Please check the Project Gutenberg web pages for current


donation methods and addresses. Donations are accepted in a
number of other ways including checks, online payments and
credit card donations. To donate, please visit:
www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could
be freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose
network of volunteer support.

Project Gutenberg™ eBooks are often created from several


printed editions, all of which are confirmed as not protected by
copyright in the U.S. unless a copyright notice is included. Thus,
we do not necessarily keep eBooks in compliance with any
particular paper edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg
Literary Archive Foundation, how to help produce our new
eBooks, and how to subscribe to our email newsletter to hear
about new eBooks.
back
back
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like