Heat the oil in a heavy saucepan. Add the onion and cook over low heat until soft, about 3 minutes. Add the rice and cook, stirring, another 3 minutes.
Meanwhile, bring the stock to a boil in another saucepan. Reduce the heat and keep it at a simmer.
Slowly add 1 cup of the hot stock to the rice, stirring constantly. Continue to stir, allowing the rice to simmer. When the stock has been absorbed, add 1/2 cup and allow it to simmer, stirring well until it has been absorbed. Continue adding the broth 1/2 cup at a time, stirring constantly, until almost all the broth has been added.
Add the pesto and continue cooking, adding the remaining broth in 1/4 cup amounts, stirring constantly, until the rice is slightly creamy and tender. Altogether, the rice should cook for about 25 to 30 minutes. When all the broth has been absorbed, stir in the Parmesan, walnuts, and black pepper. Serve immediatlely. Enjoy!
You may substitute parsley pesto or some other pesto for the basil for a nice variation.